Skip to content
Permalink
Browse files
reduce number of w variables used from 64 to 16 by reusing them
  • Loading branch information
mherkender committed Apr 2, 2012
1 parent 683b671 commit 9cc8e7405a4174cd8bb90781f3cd27ef58660536
Show file tree
Hide file tree
Showing 2 changed files with 130 additions and 130 deletions.
@@ -14,10 +14,10 @@
if j < 16:
print "var w%s:uint = byteInput.readUnsignedInt();" % j
else:
print "var w%s:uint = w%s ^ w%s ^ w%s ^ w%s; w%s = (w%s << 1) | (w%s >>> 31);" % (j, j - 3, j - 8, j - 14, j - 16, j, j, j)
print "w%s ^= w%s ^ w%s ^ w%s; w%s = (w%s << 1) | (w%s >>> 31);" % (j % 16, (j - 3) % 16, (j - 8) % 16, (j - 14) % 16, j % 16, j % 16, j % 16)
print "tmp = ((a << 5) | (a >>> 27)) + (%s) + e + 0x%08X + w%s; " \
"e = d; " \
"d = c; " \
"c = (b << 30) | (b >>> 2); " \
"b = a; " \
"a = tmp;" % (f, k, j)
"a = tmp;" % (f, k, j % 16)

0 comments on commit 9cc8e74

Please sign in to comment.