Symmetric Bijective Algorithm for Integers -
i need algorithm can one-to-one mapping (ie. no collision) of 32-bit signed integer onto 32-bit signed integer.
my real concern enough entropy output of function appears random. looking cipher similar xor cipher can generate more arbitrary-looking outputs. security not real concern, although obscurity is.
edit clarification purpose:
- the algorithm must symetric, can reverse operation without keypair.
- the algorithm must bijective, every 32-bit input number must generate 32-bit unique number.
- the output of function must obscure enough, adding 1 input should result big effect on output.
example expected result:
f(100) = 98456
f(101) = -758
f(102) = 10875498
f(103) = 986541
f(104) = 945451245
f(105) = -488554
just md5, changing 1 thing may change lots of things.
i looking mathmetical function, manually mapping integers not solution me. asking, algorithm speed not important.
use 32-bit block cipher! definition, block cipher maps every possible input value in range unique output value, in reversible fashion, , design, it's difficult determine given value map without key. pick key, keep secret if security or obscurity important, , use cipher transformation.
for extension of idea non-power-of-2 ranges, see post on secure permutations block ciphers.
addressing specific concerns:
- the algorithm indeed symmetric. i'm not sure mean "reverse operation without keypair". if don't want use key, hardcode randomly generated 1 , consider part of algorithm.
- yup - definition, block cipher bijective.
- yup. wouldn't cipher if not case.
Comments
Post a Comment