Updated on 2026-08-14

This commit is contained in:
Tangem 2020-04-01 14:04:54 +03:00
parent 926c92f700
commit 8bc1d4bc88

View file

@ -12,6 +12,12 @@ fun String.calculateSha256(): ByteArray {
return sha256.digest(data)
}
fun String.calculateSha512(): ByteArray {
val sha = MessageDigest.getInstance("SHA-512")
val data = this.toByteArray(Charset.forName("UTF-8"))
return sha.digest(data)
}
fun String.hexToBytes(): ByteArray {
return ByteArray(this.length / 2)
{ i ->