Updated on 2026-08-14
This commit is contained in:
parent
63338bc540
commit
c98c70e272
2 changed files with 12 additions and 3 deletions
|
|
@ -7,8 +7,8 @@ version '0.1.0'
|
|||
dependencies {
|
||||
implementation fileTree(dir: 'libs', include: ['*.jar'])
|
||||
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version"
|
||||
implementation "com.madgag.spongycastle:core:1.56.0.0"
|
||||
implementation "com.madgag.spongycastle:prov:1.56.0.0"
|
||||
implementation "com.madgag.spongycastle:core:1.58.0.0"
|
||||
implementation "com.madgag.spongycastle:prov:1.58.0.0"
|
||||
implementation 'net.i2p.crypto:eddsa:0.3.0'
|
||||
testImplementation 'org.junit.jupiter:junit-jupiter-api:5.5.2'
|
||||
testImplementation "com.google.truth:truth:1.0"
|
||||
|
|
@ -18,7 +18,7 @@ sourceCompatibility = "8"
|
|||
targetCompatibility = "8"
|
||||
|
||||
buildscript {
|
||||
ext.kotlin_version = '1.3.50'
|
||||
ext.kotlin_version = '1.3.61'
|
||||
ext.dokka_version = '0.10.0'
|
||||
repositories {
|
||||
mavenCentral()
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
package com.tangem.common.extensions
|
||||
|
||||
import org.spongycastle.crypto.digests.RIPEMD160Digest
|
||||
import java.nio.ByteBuffer
|
||||
import java.security.MessageDigest
|
||||
import java.util.*
|
||||
|
|
@ -34,3 +35,11 @@ fun ByteArray.toDate(): Date {
|
|||
fun ByteArray.calculateSha512(): ByteArray = MessageDigest.getInstance("SHA-512").digest(this)
|
||||
|
||||
fun ByteArray.calculateSha256(): ByteArray = MessageDigest.getInstance("SHA-256").digest(this)
|
||||
|
||||
fun ByteArray.calculateRipemd160(): ByteArray {
|
||||
val digest = RIPEMD160Digest()
|
||||
digest.update(this, 0, this.size)
|
||||
val out = ByteArray(20)
|
||||
digest.doFinal(out, 0)
|
||||
return out
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue