Created
November 23, 2017 20:09
-
-
Save revington/6f68dab35625e9ed2e3d96db0ad8a327 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
'use strict'; | |
// simple feistel network | |
function feistel(input) { | |
var l1, l2, r1, r2, i = 0; | |
l1 = (input >> 16) & 65535; | |
r1 = input & 65535; | |
for (i = 0; i < 3; i++) { | |
l2 = r1; | |
r2 = l1 ^ ((((1366 * r1 + 150889) % 1114111) / 1114111.0) * 32767); | |
l1 = l2; | |
r1 = r2; | |
} | |
return (r1 << 16) + l1; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment