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:

  1. the algorithm must symetric, can reverse operation without keypair.
  2. the algorithm must bijective, every 32-bit input number must generate 32-bit unique number.
  3. 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:

  1. 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.
  2. yup - definition, block cipher bijective.
  3. yup. wouldn't cipher if not case.

Comments

Popular posts from this blog

mysql - FireDac error 314 - but DLLs are in program directory -

git - How to list all releases of public repository with GitHub API V3 -

c++ - Getting C2512 "no default constructor" for `ClassA` error on the first parentheses of constructor for `ClassB`? -