[Cryptech-Commits] [core/hash/sha512] branch clock_speed updated: Adding first double block test for SHA-512. Test ok.

git at cryptech.is git at cryptech.is
Thu Apr 5 15:04: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 5bdeacb  Adding first double block test for SHA-512. Test ok.
5bdeacb is described below

commit 5bdeacbbd8ed2fef33f4b2c6b5f75ba51b374ec6
Author: Joachim Strömbergson <joachim at secworks.se>
AuthorDate: Thu Apr 5 17:04:16 2018 +0200

    Adding first double block test for SHA-512. Test ok.
---
 src/model/python/sha512.py | 22 ++++++++++++++++++----
 1 file changed, 18 insertions(+), 4 deletions(-)

diff --git a/src/model/python/sha512.py b/src/model/python/sha512.py
index f25e6ae..3dbab00 100755
--- a/src/model/python/sha512.py
+++ b/src/model/python/sha512.py
@@ -307,10 +307,22 @@ def double_block_tests():
                  0x696A6B6C6D6E6F70, 0x6A6B6C6D6E6F7071, 0x6B6C6D6E6F707172, 0x6C6D6E6F70717273,
                  0x6D6E6F7071727374, 0x6E6F707172737475, 0x8000000000000000, 0x0000000000000000]
 
-    TC_BLOC2 = [0x0000000000000000, 0x0000000000000000, 0x0000000000000000, 0x0000000000000000,
-                0x0000000000000000, 0x0000000000000000, 0x0000000000000000, 0x0000000000000000,
-                0x0000000000000000, 0x0000000000000000, 0x0000000000000000, 0x0000000000000000,
-                0x0000000000000000, 0x0000000000000000, 0x0000000000000000, 0x0000000000000380]
+    TC_BLOCK2 = [0x0000000000000000, 0x0000000000000000, 0x0000000000000000, 0x0000000000000000,
+                 0x0000000000000000, 0x0000000000000000, 0x0000000000000000, 0x0000000000000000,
+                 0x0000000000000000, 0x0000000000000000, 0x0000000000000000, 0x0000000000000000,
+                 0x0000000000000000, 0x0000000000000000, 0x0000000000000000, 0x0000000000000380]
+
+    print("Running double block message tests.")
+    print()
+
+    my_sha512 = SHA512(mode = 'MODE_SHA_512', verbose=1)
+    TC1_expected = [0x8E959B75DAE313DA, 0x8CF4F72814FC143F, 0x8F7779C6EB9F7FA1, 0x7299AEADB6889018,
+                    0x501D289E4900F7E4, 0x331B99DEC4B5433A, 0xC7D329EEB6DD2654, 0x5E96E55B874BE909]
+    my_sha512.init()
+    my_sha512.next(TC_BLOCK1)
+    my_sha512.next(TC_BLOCK2)
+    my_digest = my_sha512.get_digest()
+    compare_digests(my_digest, TC1_expected)
 
 
 #-------------------------------------------------------------------
@@ -374,6 +386,8 @@ def main():
     print
 
     single_block_tests()
+    double_block_tests()
+
 
 #-------------------------------------------------------------------
 # __name__

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


More information about the Commits mailing list