Skip to content
Permalink
Browse files

everything is an int

  • Loading branch information
mherkender committed Apr 2, 2012
1 parent 43fa2ed commit 6aeae949fd0b73bfd9f90458c8ac22731b273183
Showing with 79 additions and 73 deletions.
  1. +8 −2 sha1-generator.py
  2. +71 −71 sha1.as
@@ -13,12 +13,18 @@
else:
f = "%s ^ %s ^ %s" % (b, c, d)
k = 0xCA62C1D6

if k > 0x80000000:
k = "- 0x%08X" % (0x100000000 - k)
else:
k = "+ 0x%08X" % k

if j < 16:
print "var w%02d:uint = byteInput.readUnsignedInt();" % j,
print "var w%02d:int = byteInput.readInt();" % j,
w_access = "w%02d" % (j % 16)
else:
print "w%02d ^= w%02d ^ w%02d ^ w%02d;" % (j % 16, (j - 3) % 16, (j - 8) % 16, (j - 14) % 16),
w_access = "(w%02d = (w%02d << 1) | (w%02d >>> 31))" % (j % 16, j % 16, j % 16)
print "%s += ((%s << 5) | (%s >>> 27)) + (%s) + 0x%08X + %s;" % (
print "%s += ((%s << 5) | (%s >>> 27)) + (%s) %s + %s;" % (
e, a, a, f, k, w_access),
print "%s = (%s << 30) | (%s >>> 2);" % (b, b, b)

0 comments on commit 6aeae94

Please sign in to comment.
You can’t perform that action at this time.