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