I hereby claim:
- I am k0shk0sh on github.
- I am imkosh (https://keybase.io/imkosh) on keybase.
- I have a public key whose fingerprint is B21B 490E C3C3 1E29 FC36 A7D8 2950 DD2D A315 EE38
To claim this, I am signing this object:
I hereby claim:
To claim this, I am signing this object:
/* | |
* Copyright 2016 Google Inc. | |
* | |
* Licensed under the Apache License, Version 2.0 (the "License"); | |
* you may not use this file except in compliance with the License. | |
* You may obtain a copy of the License at | |
* | |
* http://www.apache.org/licenses/LICENSE-2.0 | |
* | |
* Unless required by applicable law or agreed to in writing, software |
/* | |
* Copyright 2017 Google, Inc. | |
* | |
* Licensed under the Apache License, Version 2.0 (the "License"); | |
* you may not use this file except in compliance with the License. | |
* You may obtain a copy of the License at | |
* | |
* http://www.apache.org/licenses/LICENSE-2.0 | |
* | |
* Unless required by applicable law or agreed to in writing, software |
class ProfileActivityViewModel : ViewModel() { | |
val tabCounterLiveData = MutableLiveData<Pair<String, Long>>() | |
} | |
class ProfileActivity : AppCompatActivity() { | |
@Inject lateinit var viewModelFactory: ViewModelProvider.Factory | |
private val viewModel by lazy { ViewModelProviders.of(this, viewModelFactory).get(ProfileActivityViewModel::class.java) } | |
} | |
class ParentFragment : Fragment() { |
fun encrypt(context:Context, strToEncrypt: String): ByteArray { | |
val plainText = strToEncrypt.toByteArray(Charsets.UTF_8) | |
val keygen = KeyGenerator.getInstance("AES") | |
keygen.init(256) | |
val key = keygen.generateKey() | |
saveSecretKey(context, key) | |
val cipher = Cipher.getInstance("AES/CBC/PKCS5PADDING") | |
cipher.init(Cipher.ENCRYPT_MODE, key) | |
val cipherText = cipher.doFinal(plainText) |
fun encrypt(context:Context, strToEncrypt: String): ByteArray { | |
val plainText = strToEncrypt.toByteArray(Charsets.UTF_8) | |
val keygen = KeyGenerator.getInstance("AES") | |
keygen.init(256) | |
val key = keygen.generateKey() | |
saveSecretKey(context, key) | |
val cipher = Cipher.getInstance("AES/CBC/PKCS5PADDING") | |
cipher.init(Cipher.ENCRYPT_MODE, key) | |
val cipherText = cipher.doFinal(plainText) |