Remove digestString from api
This commit is contained in:
1 parent
e61ffdf978
commit
25adc330bd
16 files changed
+7
-66
No files matched your search
+1
-4
@@ -145,7 +145,7 @@ class Blake2bPure(val key: UByteArray? = null, val hashLength: Int = 64) : Blake
|
||||
}
|
||||
|
||||
|
||||
override fun digest(inputString: String, key: String?, hashLength: Int): UByteArray {
|
||||
fun digest(inputString: String, key: String?, hashLength: Int): UByteArray {
|
||||
val array = inputString.encodeToByteArray().toUByteArray()
|
||||
val keyBytes = key?.run {
|
||||
encodeToByteArray().toUByteArray()
|
||||
@@ -333,9 +333,6 @@ class Blake2bPure(val key: UByteArray? = null, val hashLength: Int = 64) : Blake
|
||||
|
||||
}
|
||||
|
||||
override fun digestString(): String {
|
||||
return digest().map { it.toString(16) }.joinToString(separator = "")
|
||||
}
|
||||
|
||||
private fun reset() {
|
||||
h = iv.copyOf()
|
||||
|
||||
+1
-5
@@ -64,7 +64,7 @@ class Sha256Pure : Sha256 {
|
||||
)
|
||||
|
||||
|
||||
override fun digest(inputString: String, key: String?, hashLength: Int): UByteArray {
|
||||
fun digest(inputString: String, key: String?, hashLength: Int): UByteArray {
|
||||
return digest(
|
||||
inputString.encodeToByteArray().toUByteArray(),
|
||||
key?.run { encodeToByteArray().toUByteArray()} ?: ubyteArrayOf(),
|
||||
@@ -312,10 +312,6 @@ class Sha256Pure : Sha256 {
|
||||
return digest
|
||||
}
|
||||
|
||||
override fun digestString(): String {
|
||||
return digest().map { it.toString(16) }.joinToString(separator = "")
|
||||
}
|
||||
|
||||
private fun appendToBuffer(array: UByteArray, start: Int) {
|
||||
array.copyInto(destination = buffer, destinationOffset = start, startIndex = 0, endIndex = array.size)
|
||||
bufferCounter += array.size
|
||||
|
||||
-14
@@ -16,8 +16,6 @@
|
||||
|
||||
package com.ionspin.kotlin.crypto.hash.sha
|
||||
|
||||
import com.ionspin.kotlin.crypto.hash.StatelessHash
|
||||
import com.ionspin.kotlin.crypto.hash.UpdatableHash
|
||||
import com.ionspin.kotlin.crypto.util.rotateRight
|
||||
|
||||
/**
|
||||
@@ -134,14 +132,6 @@ class Sha512Pure : Sha512 {
|
||||
)
|
||||
|
||||
|
||||
override fun digest(inputString: String, key: String?, hashLength: Int): UByteArray {
|
||||
return digest(
|
||||
inputString.encodeToByteArray().toUByteArray(),
|
||||
key?.run { encodeToByteArray().toUByteArray() } ?: ubyteArrayOf(),
|
||||
hashLength = hashLength
|
||||
)
|
||||
}
|
||||
|
||||
override fun digest(inputMessage: UByteArray, key: UByteArray, hashLength: Int): UByteArray {
|
||||
|
||||
var h = iv.copyOf()
|
||||
@@ -389,10 +379,6 @@ class Sha512Pure : Sha512 {
|
||||
return digest
|
||||
}
|
||||
|
||||
override fun digestString(): String {
|
||||
return digest().map { it.toString(16) }.joinToString(separator = "")
|
||||
}
|
||||
|
||||
private fun appendToBuffer(array: UByteArray, start: Int) {
|
||||
array.copyInto(destination = buffer, destinationOffset = start, startIndex = 0, endIndex = array.size)
|
||||
bufferCounter += array.size
|
||||
|
||||
+2
-1
@@ -16,6 +16,7 @@
|
||||
|
||||
package com.ionspin.kotlin.crypto.hash.blake2b
|
||||
|
||||
import com.ionspin.kotlin.crypto.util.toHexString
|
||||
import kotlin.test.Test
|
||||
import kotlin.test.assertTrue
|
||||
|
||||
@@ -64,7 +65,7 @@ class Blake2bInstanceTest {
|
||||
for (i in 0 until updates) {
|
||||
blake2b.update(input)
|
||||
}
|
||||
val result = blake2b.digestString()
|
||||
val result = blake2b.digest().toHexString()
|
||||
assertTrue {
|
||||
result == expectedResult
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user