Fast and simple String encrypt/decrypt in JAVA

后端 未结 4 693
猫巷女王i
猫巷女王i 2020-12-02 04:28

I need fast and simple way to encrypt/decrypt a \"lot\" of String data. I tried jasypt but it crashes on my Androi

4条回答
  •  心在旅途
    2020-12-02 05:02

    Simplest way is to add this JAVA library using Gradle:

    compile 'se.simbio.encryption:library:2.0.0'
    

    You can use it as simple as this:

    Encryption encryption = Encryption.getDefault("Key", "Salt", new byte[16]);
    String encrypted = encryption.encryptOrNull("top secret string");
    String decrypted = encryption.decryptOrNull(encrypted);
    

提交回复
热议问题