[Cryptech-Commits] [core/hash/sha512] branch clock_speed updated: Moved tests to separate function to allow for adding multi block message tests.
git at cryptech.is
git at cryptech.is
Thu Apr 5 14:43:57 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 e0ce9f8 Moved tests to separate function to allow for adding multi block message tests.
e0ce9f8 is described below
commit e0ce9f8797171aeff46176c7b3d6129ace9be30b
Author: Joachim Strömbergson <joachim at secworks.se>
AuthorDate: Thu Apr 5 16:43:48 2018 +0200
Moved tests to separate function to allow for adding multi block message tests.
---
src/model/python/sha512.py | 28 +++++++++++++++++++---------
1 file changed, 19 insertions(+), 9 deletions(-)
diff --git a/src/model/python/sha512.py b/src/model/python/sha512.py
index 8116c20..9e7cded 100755
--- a/src/model/python/sha512.py
+++ b/src/model/python/sha512.py
@@ -192,7 +192,7 @@ class SHA512():
print("c = 0x%016x, d = 0x%016x" % (self.c, self.d))
print("e = 0x%016x, f = 0x%016x" % (self.e, self.f))
print("g = 0x%016x, h = 0x%016x" % (self.g, self.h))
- print("")
+ print()
def _sha512_round(self, round):
@@ -262,7 +262,7 @@ class SHA512():
print("k = 0x%016x, w = 0x%016x" % (k, w))
print("Ch = 0x%016x, sigma1 = 0x%016x" % (self._Ch(e, f, g), self._sigma1(e)))
print("T1 = 0x%016x" % (T1))
- print("")
+ print()
return T1
@@ -296,16 +296,15 @@ def compare_digests(digest, expected):
#-------------------------------------------------------------------
-# main()
+# single_block_tests()
#
-# If executed tests the ChaCha class using known test vectors.
+# NIST test with single block messages for the different
+# versions of SHA-512.
#-------------------------------------------------------------------
-def main():
- print("Testing the SHA-512 Python model.")
- print("---------------------------------")
- print
+def single_block_tests():
+ print("Running single block message tests.")
+ print()
- # Single block message.
TC1_block = [0x6162638000000000, 0x0000000000000000, 0x0000000000000000, 0x0000000000000000,
0x0000000000000000, 0x0000000000000000, 0x0000000000000000, 0x0000000000000000,
0x0000000000000000, 0x0000000000000000, 0x0000000000000000, 0x0000000000000000,
@@ -346,6 +345,17 @@ def main():
compare_digests(my_digest, TC4_expected)
+#-------------------------------------------------------------------
+# main()
+#
+# If executed tests the ChaCha class using known test vectors.
+#-------------------------------------------------------------------
+def main():
+ print("Testing the SHA-512 Python model.")
+ print("---------------------------------")
+ print
+
+ single_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