Simple integer encryption

后端 未结 9 1491
南方客
南方客 2020-12-03 06:24

Is there a simple algorithm to encrypt integers? That is, a function E(i,k) that accepts an n-bit integer and a key (of any type) and produces another, unrelated n-bit integ

9条回答
  •  忘掉有多难
    2020-12-03 06:47

    If you just want to look random and don't care about security, how about just swapping bits around. You could simply reverse the bit string, so the high bit becomes the low bit, second highest, second lowest, etc, or you could do some other random permutation (eg 1 to 4, 2 to 7 3 to 1, etc.

提交回复
热议问题