Fast, simple to use symmetric cipher for integer encryption in Java

后端 未结 3 2053
误落风尘
误落风尘 2021-02-10 03:15

What is in Java a cipher function for integer encryption having these properties?:

  • Fast
  • Symmetric-key algorithm
  • Simple to use (i.e. a couple of
3条回答
  •  孤城傲影
    2021-02-10 03:39

    If you don't need a secure solution, but just fast one, consider the XOR cipher:

    int key = ...
    ....
    int b = a ^ key;
    int c = b ^ key;
    assert (c == a);
    

提交回复
热议问题