diff options
author | Joachim StroĢmbergson <joachim@secworks.se> | 2018-04-06 13:42:43 +0200 |
---|---|---|
committer | Joachim StroĢmbergson <joachim@secworks.se> | 2018-04-06 13:42:43 +0200 |
commit | 69cebd617e1a2ad8eadde7e8c813a4b0c53705bb (patch) | |
tree | fe8a89525a8ffa2ba3d7c9e4a454c45376cc4f2a /src/model | |
parent | d7669fc974ad1616d5cd7178f91525f609d3971a (diff) |
Added support for dumping T2 inputs and calculations.
Diffstat (limited to 'src/model')
-rwxr-xr-x | src/model/python/sha512.py | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/src/model/python/sha512.py b/src/model/python/sha512.py index 672dc73..8bc1793 100755 --- a/src/model/python/sha512.py +++ b/src/model/python/sha512.py @@ -257,7 +257,6 @@ class SHA512(): def _T1(self, e, f, g, h, k, w): T1 = (h + self._sigma1(e) + self._Ch(e, f, g) + k + w) & MAX_64BIT - if self.verbose: print("Inputs, calculations and result for T1:") print("e = 0x%016x, f = 0x%016x, g = 0x%016x, h = 0x%016x" % (e, f, g, h)) @@ -265,12 +264,18 @@ class SHA512(): print("Ch = 0x%016x, sigma1 = 0x%016x" % (self._Ch(e, f, g), self._sigma1(e))) print("T1 = 0x%016x" % (T1)) print() - return T1 def _T2(self, a, b, c): - return (self._sigma0(a) + self._Maj(a, b, c)) & MAX_64BIT + T2 = (self._sigma0(a) + self._Maj(a, b, c)) & MAX_64BIT + if self.verbose: + print("Inputs, calculations and result for T2:") + print("a = 0x%016x, b = 0x%016x, c = 0x%016x" % (a, b, c)) + print("Maj = 0x%016x, sigma0 = 0x%016x" % (self._Maj(a, b, c), self._sigma0(a))) + print("T2 = 0x%016x" % (T2)) + print() + return T2 def _rotr64(self, n, r): |