Permalink
Browse files

convert w array to individual local variables

  • Loading branch information...
1 parent 46891e3 commit 138e2ba5acca70e2de98338b099bbbb0a0f3f00f @mherkender committed Apr 2, 2012
Showing with 165 additions and 93 deletions.
  1. +5 −1 sha1-generator.py
  2. +160 −92 sha1.as
View
@@ -11,7 +11,11 @@
else:
f = "b ^ c ^ d"
k = 0xCA62C1D6
- print "tmp = ((a << 5) | (a >>> 27)) + (%s) + e + 0x%08X + w[%s]; " \
+ if j < 16:
+ print "var w%s:uint = strToInt(input, i + %s);" % (j, j * 4)
+ 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 "tmp = ((a << 5) | (a >>> 27)) + (%s) + e + 0x%08X + w%s; " \
"e = d; " \
"d = c; " \
"c = (b << 30) | (b >>> 2); " \
Oops, something went wrong.

0 comments on commit 138e2ba

Please sign in to comment.