[Cryptech-Commits] [core/hash/sha512] branch clock_speed updated: Minor cleanup of names to make the code clearer.

git at cryptech.is git at cryptech.is
Fri Apr 6 07:43:27 UTC 2018


This is an automated email from the git hooks/post-receive script.

joachim at secworks.se pushed a commit to branch clock_speed
in repository core/hash/sha512.

The following commit(s) were added to refs/heads/clock_speed by this push:
     new 00827a6  Minor cleanup of names to make the code clearer.
00827a6 is described below

commit 00827a6c00a5e11c98931b0c2fcd0386f38ecd3b
Author: Joachim Strömbergson <joachim at secworks.se>
AuthorDate: Fri Apr 6 09:43:18 2018 +0200

    Minor cleanup of names to make the code clearer.
---
 src/model/python/sha512.py | 37 ++++++++++++++++++-------------------
 1 file changed, 18 insertions(+), 19 deletions(-)

diff --git a/src/model/python/sha512.py b/src/model/python/sha512.py
index ad5b1fb..bca62af 100755
--- a/src/model/python/sha512.py
+++ b/src/model/python/sha512.py
@@ -364,45 +364,44 @@ def double_block_tests():
 def single_block_tests():
     print("Running single block message tests.")
 
-    TC1_block = [0x6162638000000000, 0x0000000000000000, 0x0000000000000000, 0x0000000000000000,
-                 0x0000000000000000, 0x0000000000000000, 0x0000000000000000, 0x0000000000000000,
-                 0x0000000000000000, 0x0000000000000000, 0x0000000000000000, 0x0000000000000000,
-                 0x0000000000000000, 0x0000000000000000, 0x0000000000000000, 0x0000000000000018]
+    TC_BLOCK = [0x6162638000000000, 0x0000000000000000, 0x0000000000000000, 0x0000000000000000,
+                0x0000000000000000, 0x0000000000000000, 0x0000000000000000, 0x0000000000000000,
+                0x0000000000000000, 0x0000000000000000, 0x0000000000000000, 0x0000000000000000,
+                0x0000000000000000, 0x0000000000000000, 0x0000000000000000, 0x0000000000000018]
 
     print("Test case for SHA-512-224.")
-    TC2_expected = [0x4634270f707b6a54, 0xdaae7530460842e2, 0x0e37ed265ceee9a4, 0x3e8924aa00000000]
+    TC224_expected = [0x4634270f707b6a54, 0xdaae7530460842e2, 0x0e37ed265ceee9a4, 0x3e8924aa00000000]
     my_sha512 = SHA512(mode = 'MODE_SHA_512_224', verbose = 0)
     my_sha512.init()
-    my_sha512.next(TC1_block)
+    my_sha512.next(TC_BLOCK)
     my_digest = my_sha512.get_digest()
-    compare_digests(my_digest, TC2_expected)
+    compare_digests(my_digest, TC224_expected)
 
     print("Test case for SHA-512-256.")
-    TC3_expected = [0x53048e2681941ef9, 0x9b2e29b76b4c7dab, 0xe4c2d0c634fc6d46, 0xe0e2f13107e7af23]
+    TC256_expected = [0x53048e2681941ef9, 0x9b2e29b76b4c7dab, 0xe4c2d0c634fc6d46, 0xe0e2f13107e7af23]
     my_sha512 = SHA512(mode = 'MODE_SHA_512_256', verbose = 0)
     my_sha512.init()
-    my_sha512.next(TC1_block)
+    my_sha512.next(TC_BLOCK)
     my_digest = my_sha512.get_digest()
-    compare_digests(my_digest, TC3_expected)
-
+    compare_digests(my_digest, TC256_expected)
 
     print("Test case for SHA-512-384.")
-    TC4_expected = [0xcb00753f45a35e8b, 0xb5a03d699ac65007, 0x272c32ab0eded163, 0x1a8b605a43ff5bed,
-                    0x8086072ba1e7cc23, 0x58baeca134c825a7]
+    TC384_expected = [0xcb00753f45a35e8b, 0xb5a03d699ac65007, 0x272c32ab0eded163,
+                      0x1a8b605a43ff5bed, 0x8086072ba1e7cc23, 0x58baeca134c825a7]
     my_sha512 = SHA512(mode = 'MODE_SHA_512_384', verbose = 0)
     my_sha512.init()
-    my_sha512.next(TC1_block)
+    my_sha512.next(TC_BLOCK)
     my_digest = my_sha512.get_digest()
-    compare_digests(my_digest, TC4_expected)
+    compare_digests(my_digest, TC384_expected)
 
     print("Test case for SHA-512.")
-    TC1_expected = [0xddaf35a193617aba, 0xcc417349ae204131, 0x12e6fa4e89a97ea2, 0x0a9eeee64b55d39a,
-                    0x2192992a274fc1a8, 0x36ba3c23a3feebbd, 0x454d4423643ce80e, 0x2a9ac94fa54ca49f]
+    TC512_expected = [0xddaf35a193617aba, 0xcc417349ae204131, 0x12e6fa4e89a97ea2, 0x0a9eeee64b55d39a,
+                      0x2192992a274fc1a8, 0x36ba3c23a3feebbd, 0x454d4423643ce80e, 0x2a9ac94fa54ca49f]
     my_sha512 = SHA512(mode = 'MODE_SHA_512', verbose = 0)
     my_sha512.init()
-    my_sha512.next(TC1_block)
+    my_sha512.next(TC_BLOCK)
     my_digest = my_sha512.get_digest()
-    compare_digests(my_digest, TC1_expected)
+    compare_digests(my_digest, TC512_expected)
     print()
 
 

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the Commits mailing list