Skip to content

Instantly share code, notes, and snippets.

faiz786 / Decryptor.kt
Created March 29, 2018 10:57 — forked from zukopvd/Decryptor.kt
Android Decryptor (Helper class)
View Decryptor.kt
class Decryptor(private val storage: SharedPreferences) {
private val ANDROID_KEY_STORE = "AndroidKeyStore"
private val TRANSFORMATION = "AES/GCM/NoPadding"
private var keyStore: KeyStore? = null
init {
faiz786 / Encryptor.kt
Created March 29, 2018 10:54 — forked from zukopvd/Encryptor.kt
Android Encryptor (Helper class)
View Encryptor.kt
class Encryptor(private val sharedPreferences: SharedPreferences) {
private val ANDROID_KEY_STORE = "AndroidKeyStore"
private var initVector: ByteArray? = null
private var encryption: ByteArray? = null
private val TRANSFORMATION = "AES/GCM/NoPadding"
fun encryptTextWithAES(alias: String, textToEncrypt: String): ByteArray? {
var alias = alias
View PayloadBinding.kt
override fun onBindViewHolder(holder: ViewHolder,
position: Int,
payloads: MutableList<Any>) {
if (!payloads.isEmpty()) {
// Because these updates can be batched,
// there can be multiple payloads for a single bind
when (payloads[0]) {
// Change only the "favorite" icon,
// leave background image alone: