nonJvmMain.cash.z.ecc.android.crypto.SecretKeyFactoryCommon.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of kotlin-bip39 Show documentation
Show all versions of kotlin-bip39 Show documentation
A concise implementation of BIP-0039 in Kotlin.
The newest version!
package cash.z.ecc.android.crypto
internal actual class SecretKeyFactoryCommon() {
actual fun generateSecret(pbeKeySpec: PBEKeySpecCommon): SecretKeyCommon {
val encoded =
pbeKeySpec.run {
Pbkdf2Sha512.derive(password!!, salt!!, iterationCount, keyLength)
}
return SecretKeyCommon(encoded)
}
actual companion object {
actual fun getInstance(algorithm: String): SecretKeyFactoryCommon = SecretKeyFactoryCommon()
actual fun getInstance(
algorithm: String,
provider: FallbackProvider,
): SecretKeyFactoryCommon = SecretKeyFactoryCommon()
}
}