Cleanup deprecated methods.
Noticed a handful of deprecated methods and minor warnings while looking around. Replaces with recommended methods
This commit is contained in:
9 files changed
+16
-14
No files matched your search
@@ -3,13 +3,15 @@ package com.ionspin.kotlin.crypto
|
||||
import com.ionspin.kotlin.crypto.hash.MultipartHash
|
||||
import com.ionspin.kotlin.crypto.hash.encodeToUByteArray
|
||||
import com.ionspin.kotlin.crypto.util.toHexString
|
||||
import kotlin.jvm.JvmInline
|
||||
|
||||
/**
|
||||
* Created by Ugljesa Jovanovic
|
||||
* ugljesa.jovanovic@ionspin.com
|
||||
* on 23-Jun-2020
|
||||
*/
|
||||
inline class EncryptableString(val content: String) : Encryptable<EncryptableString> {
|
||||
@JvmInline
|
||||
value class EncryptableString(val content: String) : Encryptable<EncryptableString> {
|
||||
override fun toEncryptableForm(): UByteArray {
|
||||
return content.encodeToUByteArray()
|
||||
}
|
||||
|
||||
+1
-1
@@ -44,4 +44,4 @@ interface XChaCha20KeyProvider {
|
||||
fun generateNewKey() : XChaCha20.Key
|
||||
|
||||
fun createFromUByteArray(uByteArray: UByteArray) : XChaCha20.Key
|
||||
}
|
||||
}
|
||||
+2
-2
@@ -8,13 +8,13 @@ package com.ionspin.kotlin.crypto.util
|
||||
val _emit = IntArray(0)
|
||||
|
||||
fun UByteArray.overwriteWithZeroes() {
|
||||
for (i in 0 until size) {
|
||||
for (i in indices) {
|
||||
this[i] = 0U
|
||||
}
|
||||
}
|
||||
|
||||
fun UIntArray.overwriteWithZeroes() {
|
||||
for (i in 0 until size) {
|
||||
for (i in indices) {
|
||||
this[i] = 0U
|
||||
}
|
||||
}
|
||||
+4
-4
@@ -7,22 +7,22 @@ package com.ionspin.kotlin.crypto.util
|
||||
*/
|
||||
fun Array<Byte>.hexColumsPrint() {
|
||||
val printout = this.map { it.toString(16) }.chunked(16)
|
||||
printout.forEach { println(it.joinToString(separator = " ") { it.toUpperCase() }) }
|
||||
printout.forEach { println(it.joinToString(separator = " ") { it.uppercase() }) }
|
||||
}
|
||||
|
||||
fun Array<UByte>.hexColumsPrint(chunk : Int = 16) {
|
||||
val printout = this.map { it.toString(16).padStart(2, '0') }.chunked(chunk)
|
||||
printout.forEach { println(it.joinToString(separator = " ") { it.toUpperCase() }) }
|
||||
printout.forEach { println(it.joinToString(separator = " ") { it.uppercase() }) }
|
||||
}
|
||||
|
||||
fun UByteArray.hexColumsPrint(chunk : Int = 16) {
|
||||
val printout = this.map { it.toString(16).padStart(2, '0') }.chunked(chunk)
|
||||
printout.forEach { println(it.joinToString(separator = " ") { it.toUpperCase() }) }
|
||||
printout.forEach { println(it.joinToString(separator = " ") { it.uppercase() }) }
|
||||
}
|
||||
|
||||
fun Array<ULong>.hexColumsPrint(chunk: Int = 3) {
|
||||
val printout = this.map { it.toString(16) }.chunked(chunk)
|
||||
printout.forEach { println(it.joinToString(separator = " ") { it.toUpperCase() }) }
|
||||
printout.forEach { println(it.joinToString(separator = " ") { it.uppercase() }) }
|
||||
}
|
||||
|
||||
fun String.hexStringToTypedUByteArray() : Array<UByte> {
|
||||
|
||||
Reference in new issue
Block a user