Skip to content

Instantly share code, notes, and snippets.

@yakivmospan
Created November 1, 2017 18:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save yakivmospan/2198b5c319aca7346b249899ef4ced9c to your computer and use it in GitHub Desktop.
Save yakivmospan/2198b5c319aca7346b249899ef4ced9c to your computer and use it in GitHub Desktop.
fun encrypt(data: String, key: Key?): String {
cipher.init(Cipher.ENCRYPT_MODE, key)
val bytes = cipher.doFinal(data.toByteArray())
return Base64.encodeToString(bytes, Base64.DEFAULT)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment