aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rwxr-xr-xsrc/model/python/sha512.py22
1 files 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__