4 ms·
(Generalized) Feistel networks have to be neither balanced nor over bits (see, e.g., [1]), so you could conceivably devise a 'perfect' permutation for any parti
by pbsd 9y ago
(Generalized) Feistel networks have to be neither balanced nor over bits (see, e.g., [1]), so you could conceivably devise a 'perfect' permutation for any particular resolution.
For example, with 320x200, you'd do something like (completely untested)
for (var i = 0; i < 8; i++) {
l = input / 320;
r = input % 320;
var nl = r;
var F = (r * 356357 + i * 1234567) % 200;
r = (l + F) % 200;
l = nl;
input = 200*l + r;
}
which is not exactly fast or anything, but covers your domain perfectly.
[1] https://eprint.iacr.org/2010/301 https://eprint.iacr.org/2010/301
- deleted 9y ago[deleted]
- Scaevolus 9y agoYes, this works well! http://jsbin.com/xepefubuyu/2/edit?js,output http://jsbin.com/xepefubuyu/2/edit?js,output
- antirez 9y agoThis is great! Thanks.
- antirez 9y agoOff topic: @pbsd your comment history is amazing for quality, topics covered and so forth, it's a shame you have no "about" section in the HN account, I bet many people would be glad to be able to follow your Blog / Twitter / whatever. I also respect people that don't want exposure, so take this just as an appreciation comment in case you don't like the suggestion.