Created
December 11, 2014 04:15
flipBytes Serpent
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
data byte[32] | |
def flipBytes(n): | |
numByte = 5 | |
mask = 0xff | |
i = 0 | |
while i < numByte: | |
b = n & mask | |
b /= 2^(i*8) | |
b *= 2^((numByte-i-1)*8) | |
mask *= 256 | |
byte[i] = b | |
i += 1 | |
ret = byte[0] | |
i = 1 | |
while i < numByte: | |
ret = ret | byte[i] | |
i += 1 | |
return(ret) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
To get unsigned ints in Serpent:
map(lambda x: x%2**256, s.send(t.k0, c, 0, funid=5, abi=[]))