Created
November 21, 2016 16:32
-
-
Save advincze/e53024183ff9588788b7832a51e1f684 to your computer and use it in GitHub Desktop.
This file contains 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
func pearson(msg, iv []byte, bytecount int) []byte { | |
var h byte | |
hh := make([]byte, bytecount) | |
for j := 0; j < bytecount; j++ { | |
h = iv[(int(msg[0])+j)%256] | |
for i := 1; i < len(msg); i++ { | |
h = iv[h^msg[i]] | |
} | |
hh[j] = h | |
} | |
return hh | |
} | |
func scramble(seed []byte) []byte { | |
ss := make([]byte, 256) | |
for i := 0; i < 256; i++ { | |
ss[i] = byte(i) | |
} | |
j := 0 | |
for i := 0; i < 256; i++ { | |
j = (j + int(ss[i]) + int(seed[i%len(seed)])) % 256 | |
ss[i], ss[j] = ss[j], ss[i] | |
} | |
return ss | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment