simbiose / Encryption

Encryption is a simple way to encrypt and decrypt strings on Android and Java project.
MIT License
354 stars 79 forks source link
android decrypt-strings encryption java kotlin kotlin-android

Encryption

Encryption is a simple way to encrypt and decrypt strings on Android and Java project.

Android Arsenal Build Status Build Status

How to use

1º Add JitPack to your build file

allprojects {
  repositories {
    ...
    maven { url 'https://jitpack.io' }
  }
}

2º Add the gradle dependency

compile 'com.github.simbiose:Encryption:2.0.1'

3º Get an Encryption instance

String key = "YourKey";
String salt = "YourSalt";
byte[] iv = new byte[16];
Encryption encryption = Encryption.getDefault(key, salt, iv);

4º Encrypt your text

String encrypted = encryption.encryptOrNull("Text to be encrypt");

5º Decrypt your text

String decrypted = encryption.decryptOrNull(encrypted);

Custom usage

You can use you own builder

Encryption encryption = new Encryption.Builder()
                .setKeyLength(128)
                .setKey("YourKey")
                .setSalt("YourSalt")
                .setIv(yourByteIvArray)
                .setCharsetName("UTF8")
                .setIterationCount(1)
                .setDigestAlgorithm("SHA1")
                .setBase64Mode(Base64.DEFAULT)
                .setAlgorithm("AES/CBC/PKCS5Padding")
                .setSecureRandomAlgorithm("SHA1PRNG")
                .setSecretKeyType("PBKDF2WithHmacSHA1")
                .build();

See more on Examples folder, there is an Android, a Java and a Kotlin project.

FAQ

Want to contribute?

Fell free to contribute, We really like pull requests :octocat:

Third part