Symmetric Bijective Algorithm for Integers

后端 未结 11 879
甜味超标
甜味超标 2020-12-01 03:33

I need an algorithm that can do a one-to-one mapping (ie. no collision) of a 32-bit signed integer onto another 32-bit signed integer.

My real concern is enough entr

11条回答
  •  谎友^
    谎友^ (楼主)
    2020-12-01 04:23

    Apart from generating random lookup-tables, you can use a combination of functions:

    • XOR
    • symmetric bit permutation (for example shift 16 bits, or flip 0-31 to 31-0, or flip 0-3 to 3-0, 4-7 to 7-4, ...)
    • more?

提交回复
热议问题