All Downloads are FREE. Search and download functionalities are using the official Maven repository.

tech.relaycorp.relaynet.CryptoUtils.kt Maven / Gradle / Ivy

There is a newer version: 1.69.11
Show newest version
@file:JvmName("CryptoUtils")

package tech.relaycorp.relaynet

import java.security.MessageDigest
import org.bouncycastle.jce.provider.BouncyCastleProvider

internal fun getSHA256Digest(input: ByteArray): ByteArray {
    val digest = MessageDigest.getInstance("SHA-256")
    return digest.digest(input)
}

internal fun getSHA256DigestHex(input: ByteArray) =
    getSHA256Digest(input).joinToString("") { "%02x".format(it) }

internal val BC_PROVIDER = BouncyCastleProvider()




© 2015 - 2024 Weber Informatics LLC | Privacy Policy