Low level core cryptographic components for Kotlin Multiplatform
NOTE: For Jvm, Digest
extends java.security.MessageDigest
and Mac
extends javax.crypto.Mac
for interoperability.
Modules in core
are intentionally single purpose and small such that you
are able to include them in your APIs without having to import some massive crypto
library. Consumers of your APIs can then import the higher level implementations
to use with your library (giving them the choice of what algorithms they wish
to use, importing only what they need).
This also means that as new higher level functions get implemented, you do not need to do anything.
/**
* This feature of Foo requires a dependency if you wish to use it.
* See: https://github.com/KotlinCrypto/hash
* */
class FooFeatureA(digest: Digest) {
// ...
}
The best way to keep KotlinCrypto
dependencies up to date is by using the
version-catalog. Alternatively, see below.
// build.gradle.kts
dependencies {
val core = "0.6.0"
implementation("org.kotlincrypto.core:digest:$core")
implementation("org.kotlincrypto.core:mac:$core")
implementation("org.kotlincrypto.core:xof:$core")
}