Skip to content

Commit

Permalink
convert w array to individual local variables
Browse files Browse the repository at this point in the history
  • Loading branch information
mherkender committed Apr 2, 2012
1 parent 46891e3 commit 138e2ba
Show file tree
Hide file tree
Showing 2 changed files with 165 additions and 93 deletions.
6 changes: 5 additions & 1 deletion sha1-generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -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); " \
Expand Down
Loading

0 comments on commit 138e2ba

Please sign in to comment.