Module cryptography-random¶
CryptographyRandom: zero-dependency platform-dependent CSPRNG exposed via kotlin.Random API
Depending on target/platform uses:
- JVM - SecureRandom
- JS - Crypto.getRandomValues
- WasmJs - Crypto.getRandomValues
- WasmWasi - random_get
- Apple(macOS, iOS, tvOS, watchOS) - CCRandomGenerateBytes
- Linux - getrandom with fallback to urandom
- Mingw - BCryptGenRandom
Example¶
val bytes: ByteArray = CryptographyRandom.nextBytes(20)
Using in your projects¶
dependencies {
implementation("dev.whyoleg.cryptography:cryptography-random:0.4.0")
}
Package dev.whyoleg.cryptography.random¶
CryptographyRandom: zero-dependency platform-dependent CSPRNG exposed via kotlin.Random API