From 3ad86e284a97a307d9fc223e4863c717146a836f Mon Sep 17 00:00:00 2001 From: Ugljesa Jovanovic Date: Fri, 5 Jun 2020 20:13:21 +0200 Subject: [PATCH] Remove all annotations --- .../com/ionspin/kotlin/crypto/hash/Hash.kt | 4 +- .../kotlin/crypto/hash/blake2b/Blake2b.kt | 6 +-- .../com/ionspin/kotlin/crypto/Crypto.kt | 22 +++++----- .../crypto/hash/blake2b/Blake2bDelegated.kt | 4 +- .../kotlin/crypto/hash/sha/Sha256Pure.kt | 6 +-- .../kotlin/crypto/hash/sha/Sha512Pure.kt | 6 +-- .../kotlin/crypto/symmetric/AesCbcPure.kt | 4 +- .../kotlin/crypto/symmetric/AesCtrPure.kt | 4 +- .../kotlin/crypto/symmetric/AesPure.kt | 2 +- .../com/ionspin/kotlin/crypto/util/Util.kt | 42 +++++++++---------- .../kotlin/com/ionspin/kotlin/crypto/SRNG.kt | 2 +- .../crypto/hash/blake2b/Blake2bDelegated.kt | 6 +-- .../com/ionspin/kotlin/crypto/SRNGJsTest.kt | 2 +- .../crypto/hash/blake2b/Blake2bJsTest.kt | 4 +- .../kotlin/com/ionspin/kotlin/crypto/SRNG.kt | 2 +- .../crypto/hash/blake2b/Blake2bDelegated.kt | 4 +- .../crypto/hash/blake2b/Blake2bDelegated.kt | 2 +- .../crypto/hash/blake2b/Blake2bDelegated.kt | 2 +- .../kotlin/crypto/hash/blake2b/Blake2bPure.kt | 8 ++-- .../kotlin/crypto/hash/sha/Sha256Pure.kt | 6 +-- .../kotlin/crypto/hash/sha/Sha512Pure.kt | 6 +-- .../crypto/keyderivation/argon2/Argon2Pure.kt | 2 +- .../keyderivation/argon2/Argon2Utils.kt | 2 +- .../kotlin/crypto/symmetric/AesCbcPure.kt | 4 +- .../kotlin/crypto/symmetric/AesCtrPure.kt | 4 +- .../kotlin/crypto/symmetric/AesPure.kt | 2 +- .../com/ionspin/kotlin/crypto/util/Util.kt | 42 +++++++++---------- .../com/ionspin/kotlin/crypto/ReadmeTest.kt | 12 +++--- .../kotlin/crypto/hash/argon/Argon2KATTest.kt | 2 +- .../kotlin/crypto/hash/blake2b/Blake2BTest.kt | 4 +- .../hash/blake2b/Blake2bInstanceTest.kt | 4 +- .../hash/blake2b/Blake2bKnowAnswerTests.kt | 4 +- .../kotlin/crypto/hash/sha/Sha256Test.kt | 10 ++--- .../crypto/hash/sha/Sha256UpdateableTest.kt | 12 +++--- .../kotlin/crypto/hash/sha/Sha512Test.kt | 8 ++-- .../crypto/hash/sha/Sha512UpdateableTest.kt | 8 ++-- .../kotlin/crypto/symmetric/AesCbcTest.kt | 2 +- .../kotlin/crypto/symmetric/AesCtrTest.kt | 2 +- .../kotlin/crypto/symmetric/AesTest.kt | 2 +- .../ionspin/kotlin/crypto/util/UtilTest.kt | 2 +- .../kotlin/com/ionspin/kotlin/crypto/SRNG.kt | 2 +- .../com/ionspin/kotlin/crypto/SRNGJsTest.kt | 2 +- .../kotlin/com/ionspin/kotlin/crypto/SRNG.kt | 2 +- .../ionspin/kotlin/crypto/sample/Runner.kt | 2 +- .../ionspin/kotlin/crypto/sample/Runner.kt | 2 +- .../ionspin/kotlin/crypto/sample/Runner.kt | 2 +- 46 files changed, 142 insertions(+), 142 deletions(-) diff --git a/multiplatform-crypto-api/src/commonMain/kotlin/com/ionspin/kotlin/crypto/hash/Hash.kt b/multiplatform-crypto-api/src/commonMain/kotlin/com/ionspin/kotlin/crypto/hash/Hash.kt index 327556a..0b2dd6e 100644 --- a/multiplatform-crypto-api/src/commonMain/kotlin/com/ionspin/kotlin/crypto/hash/Hash.kt +++ b/multiplatform-crypto-api/src/commonMain/kotlin/com/ionspin/kotlin/crypto/hash/Hash.kt @@ -26,7 +26,7 @@ interface Hash { val MAX_HASH_BYTES : Int } -@ExperimentalUnsignedTypes + interface UpdatableHash : Hash { fun update(data : UByteArray) @@ -37,7 +37,7 @@ interface UpdatableHash : Hash { fun digestString() : String } -@ExperimentalUnsignedTypes + interface StatelessHash : Hash { fun digest(inputString: String, key: String? = null, hashLength: Int = MAX_HASH_BYTES): UByteArray diff --git a/multiplatform-crypto-api/src/commonMain/kotlin/com/ionspin/kotlin/crypto/hash/blake2b/Blake2b.kt b/multiplatform-crypto-api/src/commonMain/kotlin/com/ionspin/kotlin/crypto/hash/blake2b/Blake2b.kt index 957d782..0e3704b 100644 --- a/multiplatform-crypto-api/src/commonMain/kotlin/com/ionspin/kotlin/crypto/hash/blake2b/Blake2b.kt +++ b/multiplatform-crypto-api/src/commonMain/kotlin/com/ionspin/kotlin/crypto/hash/blake2b/Blake2b.kt @@ -8,11 +8,11 @@ import com.ionspin.kotlin.crypto.hash.UpdatableHash * ugljesa.jovanovic@ionspin.com * on 24-May-2020 */ -@ExperimentalUnsignedTypes + interface Blake2b : UpdatableHash -@ExperimentalUnsignedTypes + interface Blake2bStatelessInterface : StatelessHash { - @ExperimentalUnsignedTypes + override val MAX_HASH_BYTES: Int get() = 64 } diff --git a/multiplatform-crypto-delegated/src/commonMain/kotlin/com/ionspin/kotlin/crypto/Crypto.kt b/multiplatform-crypto-delegated/src/commonMain/kotlin/com/ionspin/kotlin/crypto/Crypto.kt index 1a3e08f..1813fd1 100644 --- a/multiplatform-crypto-delegated/src/commonMain/kotlin/com/ionspin/kotlin/crypto/Crypto.kt +++ b/multiplatform-crypto-delegated/src/commonMain/kotlin/com/ionspin/kotlin/crypto/Crypto.kt @@ -1,6 +1,5 @@ package com.ionspin.kotlin.crypto -import com.ionspin.kotlin.crypto.hash.blake2b.Blake2b import com.ionspin.kotlin.crypto.hash.blake2b.Blake2bDelegated import com.ionspin.kotlin.crypto.hash.blake2b.Blake2bStateless import com.ionspin.kotlin.crypto.hash.sha.Sha256Pure @@ -13,24 +12,23 @@ import com.ionspin.kotlin.crypto.hash.sha.Sha512Pure */ -@ExperimentalUnsignedTypes typealias Sha256Stateless = Sha256Pure.Companion -@ExperimentalUnsignedTypes + typealias Sha512Stateless = Sha512Pure.Companion -@ExperimentalUnsignedTypes + object Crypto : CryptoProvider { override suspend fun initialize() { Initializer.initialize() } - @ExperimentalUnsignedTypes - @ExperimentalStdlibApi + + object Blake2b { - fun updateable() : com.ionspin.kotlin.crypto.hash.blake2b.Blake2b { + fun updateable(): com.ionspin.kotlin.crypto.hash.blake2b.Blake2b { return Blake2bDelegated() } - fun stateless(message : String) : UByteArray { + fun stateless(message: String): UByteArray { println("?") return Blake2bStateless.digest(message) } @@ -38,15 +36,17 @@ object Crypto : CryptoProvider { } -@ExperimentalUnsignedTypes + object SimpleCrypto { - fun hash(message : String) : UByteArray { return ubyteArrayOf(0U) } + fun hash(message: String): UByteArray { + return ubyteArrayOf(0U) + } } expect object Initializer { suspend fun initialize() - fun initializeWithCallback(done : () -> (Unit)) + fun initializeWithCallback(done: () -> (Unit)) } diff --git a/multiplatform-crypto-delegated/src/commonMain/kotlin/com/ionspin/kotlin/crypto/hash/blake2b/Blake2bDelegated.kt b/multiplatform-crypto-delegated/src/commonMain/kotlin/com/ionspin/kotlin/crypto/hash/blake2b/Blake2bDelegated.kt index e4e89b1..c9d2a9d 100644 --- a/multiplatform-crypto-delegated/src/commonMain/kotlin/com/ionspin/kotlin/crypto/hash/blake2b/Blake2bDelegated.kt +++ b/multiplatform-crypto-delegated/src/commonMain/kotlin/com/ionspin/kotlin/crypto/hash/blake2b/Blake2bDelegated.kt @@ -27,10 +27,10 @@ import com.ionspin.kotlin.crypto.util.rotateRight * on 14-Jul-2019 */ -@ExperimentalUnsignedTypes + expect class Blake2bDelegated(key: UByteArray? = null, hashLength: Int = 64) : Blake2b -@ExperimentalUnsignedTypes + expect object Blake2bStateless : Blake2bStatelessInterface diff --git a/multiplatform-crypto-delegated/src/commonMain/kotlin/com/ionspin/kotlin/crypto/hash/sha/Sha256Pure.kt b/multiplatform-crypto-delegated/src/commonMain/kotlin/com/ionspin/kotlin/crypto/hash/sha/Sha256Pure.kt index ec646c1..ae0c04b 100644 --- a/multiplatform-crypto-delegated/src/commonMain/kotlin/com/ionspin/kotlin/crypto/hash/sha/Sha256Pure.kt +++ b/multiplatform-crypto-delegated/src/commonMain/kotlin/com/ionspin/kotlin/crypto/hash/sha/Sha256Pure.kt @@ -28,7 +28,7 @@ import com.ionspin.kotlin.crypto.util.rotateRight */ -@ExperimentalUnsignedTypes + class Sha256Pure : Sha256 { override val MAX_HASH_BYTES: Int = 32 @@ -65,7 +65,7 @@ class Sha256Pure : Sha256 { 0x748f82eeU, 0x78a5636fU, 0x84c87814U, 0x8cc70208U, 0x90befffaU, 0xa4506cebU, 0xbef9a3f7U, 0xc67178f2U ) - @ExperimentalStdlibApi + override fun digest(inputString: String, key: String?, hashLength: Int): UByteArray { return digest( inputString.encodeToByteArray().toUByteArray(), @@ -243,7 +243,7 @@ class Sha256Pure : Sha256 { var bufferCounter = 0 var buffer = UByteArray(BLOCK_SIZE_IN_BYTES) { 0U } - @ExperimentalStdlibApi + override fun update(data: String) { return update(data.encodeToByteArray().toUByteArray()) } diff --git a/multiplatform-crypto-delegated/src/commonMain/kotlin/com/ionspin/kotlin/crypto/hash/sha/Sha512Pure.kt b/multiplatform-crypto-delegated/src/commonMain/kotlin/com/ionspin/kotlin/crypto/hash/sha/Sha512Pure.kt index 955ee61..0e16e1a 100644 --- a/multiplatform-crypto-delegated/src/commonMain/kotlin/com/ionspin/kotlin/crypto/hash/sha/Sha512Pure.kt +++ b/multiplatform-crypto-delegated/src/commonMain/kotlin/com/ionspin/kotlin/crypto/hash/sha/Sha512Pure.kt @@ -26,7 +26,7 @@ import com.ionspin.kotlin.crypto.util.rotateRight * on 18-Jul-2019 */ -@ExperimentalUnsignedTypes + class Sha512Pure : Sha512 { override val MAX_HASH_BYTES: Int = 32 @@ -133,7 +133,7 @@ class Sha512Pure : Sha512 { 0x5be0cd19137e2179UL ) - @ExperimentalStdlibApi + override fun digest(inputString: String, key: String?, hashLength: Int): UByteArray { return digest( inputString.encodeToByteArray().toUByteArray(), @@ -318,7 +318,7 @@ class Sha512Pure : Sha512 { var bufferCounter = 0 var buffer = UByteArray(BLOCK_SIZE_IN_BYTES) { 0U } - @ExperimentalStdlibApi + override fun update(data: String) { return update(data.encodeToByteArray().toUByteArray()) } diff --git a/multiplatform-crypto-delegated/src/commonMain/kotlin/com/ionspin/kotlin/crypto/symmetric/AesCbcPure.kt b/multiplatform-crypto-delegated/src/commonMain/kotlin/com/ionspin/kotlin/crypto/symmetric/AesCbcPure.kt index 8b96fc5..134b671 100644 --- a/multiplatform-crypto-delegated/src/commonMain/kotlin/com/ionspin/kotlin/crypto/symmetric/AesCbcPure.kt +++ b/multiplatform-crypto-delegated/src/commonMain/kotlin/com/ionspin/kotlin/crypto/symmetric/AesCbcPure.kt @@ -30,7 +30,7 @@ import com.ionspin.kotlin.crypto.util.xor * ugljesa.jovanovic@ionspin.com * on 21-Sep-2019 */ -@ExperimentalUnsignedTypes + class AesCbcPure internal constructor(val aesKey: AesKey, val mode: Mode, initializationVector: UByteArray? = null) { companion object { @@ -219,7 +219,7 @@ class AesCbcPure internal constructor(val aesKey: AesKey, val mode: Mode, initia } -@ExperimentalUnsignedTypes + data class EncryptedDataAndInitializationVector(val encryptedData : UByteArray, val initilizationVector : UByteArray) { override fun equals(other: Any?): Boolean { if (this === other) return true diff --git a/multiplatform-crypto-delegated/src/commonMain/kotlin/com/ionspin/kotlin/crypto/symmetric/AesCtrPure.kt b/multiplatform-crypto-delegated/src/commonMain/kotlin/com/ionspin/kotlin/crypto/symmetric/AesCtrPure.kt index eb18ed3..6c2aa51 100644 --- a/multiplatform-crypto-delegated/src/commonMain/kotlin/com/ionspin/kotlin/crypto/symmetric/AesCtrPure.kt +++ b/multiplatform-crypto-delegated/src/commonMain/kotlin/com/ionspin/kotlin/crypto/symmetric/AesCtrPure.kt @@ -35,7 +35,7 @@ import com.ionspin.kotlin.crypto.util.xor * ugljesa.jovanovic@ionspin.com * on 22-Sep-2019 */ -@ExperimentalUnsignedTypes + class AesCtrPure internal constructor(val aesKey: AesKey, val mode: Mode, initialCounter: UByteArray? = null) { companion object { @@ -186,7 +186,7 @@ class AesCtrPure internal constructor(val aesKey: AesKey, val mode: Mode, initia } -@ExperimentalUnsignedTypes + data class EncryptedDataAndInitialCounter(val encryptedData : UByteArray, val initialCounter : UByteArray) { override fun equals(other: Any?): Boolean { if (this === other) return true diff --git a/multiplatform-crypto-delegated/src/commonMain/kotlin/com/ionspin/kotlin/crypto/symmetric/AesPure.kt b/multiplatform-crypto-delegated/src/commonMain/kotlin/com/ionspin/kotlin/crypto/symmetric/AesPure.kt index b4f8807..86ea0eb 100644 --- a/multiplatform-crypto-delegated/src/commonMain/kotlin/com/ionspin/kotlin/crypto/symmetric/AesPure.kt +++ b/multiplatform-crypto-delegated/src/commonMain/kotlin/com/ionspin/kotlin/crypto/symmetric/AesPure.kt @@ -5,7 +5,7 @@ import com.ionspin.kotlin.crypto.util.flattenToUByteArray /** * Created by Ugljesa Jovanovic (jovanovic.ugljesa@gmail.com) on 07/Sep/2019 */ -@ExperimentalUnsignedTypes + internal class AesPure internal constructor(val aesKey: AesKey, val input: UByteArray) { companion object { private val debug = false diff --git a/multiplatform-crypto-delegated/src/commonMain/kotlin/com/ionspin/kotlin/crypto/util/Util.kt b/multiplatform-crypto-delegated/src/commonMain/kotlin/com/ionspin/kotlin/crypto/util/Util.kt index abb6010..28e9232 100644 --- a/multiplatform-crypto-delegated/src/commonMain/kotlin/com/ionspin/kotlin/crypto/util/Util.kt +++ b/multiplatform-crypto-delegated/src/commonMain/kotlin/com/ionspin/kotlin/crypto/util/Util.kt @@ -62,17 +62,17 @@ inline fun Array.chunked(sliceSize: Int): Array> { } -@ExperimentalUnsignedTypes + infix fun UInt.rotateRight(places: Int): UInt { return (this shr places) xor (this shl (32 - places)) } -@ExperimentalUnsignedTypes + infix fun ULong.rotateRight(places: Int): ULong { return (this shr places) xor (this shl (64 - places)) } -@ExperimentalUnsignedTypes + infix fun Array.xor(other : Array) : Array { if (this.size != other.size) { throw RuntimeException("Operands of different sizes are not supported yet") @@ -80,7 +80,7 @@ infix fun Array.xor(other : Array) : Array { return Array(this.size) { this[it] xor other[it] } } -@ExperimentalUnsignedTypes + infix fun UByteArray.xor(other : UByteArray) : UByteArray { if (this.size != other.size) { throw RuntimeException("Operands of different sizes are not supported yet") @@ -88,17 +88,17 @@ infix fun UByteArray.xor(other : UByteArray) : UByteArray { return UByteArray(this.size) { this[it] xor other[it] } } -@ExperimentalUnsignedTypes + fun String.hexStringToTypedUByteArray() : Array { return this.chunked(2).map { it.toUByte(16) }.toTypedArray() } -@ExperimentalUnsignedTypes + fun String.hexStringToUByteArray() : UByteArray { return this.chunked(2).map { it.toUByte(16) }.toUByteArray() } -@ExperimentalUnsignedTypes + fun Array.toHexString() : String { return this.joinToString(separator = "") { if (it <= 0x0FU) { @@ -109,7 +109,7 @@ fun Array.toHexString() : String { } } -@ExperimentalUnsignedTypes + fun UByteArray.toHexString() : String { return this.joinToString(separator = "") { if (it <= 0x0FU) { @@ -121,20 +121,20 @@ fun UByteArray.toHexString() : String { } // UInt / Array utils -@ExperimentalUnsignedTypes + fun UInt.toBigEndianUByteArray() : Array { return Array (4) { ((this shr (24 - (it * 8))) and 0xFFU).toUByte() } } -@ExperimentalUnsignedTypes + fun UInt.toLittleEndianTypedUByteArray() : Array { return Array (4) { ((this shr (it * 8)) and 0xFFU).toUByte() } } -@ExperimentalUnsignedTypes + fun UInt.toLittleEndianUByteArray() : UByteArray { return UByteArray (4) { ((this shr (it * 8)) and 0xFFU).toUByte() @@ -142,27 +142,27 @@ fun UInt.toLittleEndianUByteArray() : UByteArray { } // UInt / Array utils -@ExperimentalUnsignedTypes + fun ULong.toBigEndianUByteArray() : Array { return Array (8) { ((this shr (56 - (it * 8))) and 0xFFU).toUByte() } } -@ExperimentalUnsignedTypes + fun ULong.toLittleEndianTypedUByteArray() : Array { return Array (8) { ((this shr (it * 8)) and 0xFFU).toUByte() } } -@ExperimentalUnsignedTypes + fun ULong.toLittleEndianUByteArray() :UByteArray { return UByteArray (8) { ((this shr (it * 8)) and 0xFFU).toUByte() } } -@ExperimentalUnsignedTypes + fun Array.fromLittleEndianArrayToULong() : ULong { if (this.size > 8) { throw RuntimeException("ore than 8 bytes in input, potential overflow") @@ -171,7 +171,7 @@ fun Array.fromLittleEndianArrayToULong() : ULong { return ulong } -@ExperimentalUnsignedTypes + fun UByteArray.fromLittleEndianArrayToULong() : ULong { if (this.size > 8) { throw RuntimeException("ore than 8 bytes in input, potential overflow") @@ -199,7 +199,7 @@ fun UByteArray.arrayChunked(sliceSize: Int): List { } -@ExperimentalUnsignedTypes + fun Array.fromBigEndianArrayToULong() : ULong { if (this.size > 8) { throw RuntimeException("ore than 8 bytes in input, potential overflow") @@ -213,7 +213,7 @@ fun Array.fromBigEndianArrayToULong() : ULong { return ulong } -@ExperimentalUnsignedTypes + fun Array.fromLittleEndianArrayToUInt() : UInt { if (this.size > 4) { throw RuntimeException("ore than 8 bytes in input, potential overflow") @@ -222,7 +222,7 @@ fun Array.fromLittleEndianArrayToUInt() : UInt { return uint } -@ExperimentalUnsignedTypes + fun UByteArray.fromLittleEndianArrayToUInt() : UInt { if (this.size > 4) { throw RuntimeException("ore than 8 bytes in input, potential overflow") @@ -234,7 +234,7 @@ fun UByteArray.fromLittleEndianArrayToUInt() : UInt { -@ExperimentalUnsignedTypes + fun Array.fromBigEndianArrayToUInt() : UInt { if (this.size > 4) { throw RuntimeException("ore than 8 bytes in input, potential overflow") @@ -243,7 +243,7 @@ fun Array.fromBigEndianArrayToUInt() : UInt { return uint } -@ExperimentalUnsignedTypes + operator fun UInt.plus(other : UByteArray) : UByteArray { return this.toLittleEndianUByteArray() + other } diff --git a/multiplatform-crypto-delegated/src/jsMain/kotlin/com/ionspin/kotlin/crypto/SRNG.kt b/multiplatform-crypto-delegated/src/jsMain/kotlin/com/ionspin/kotlin/crypto/SRNG.kt index b12515c..5c5269e 100644 --- a/multiplatform-crypto-delegated/src/jsMain/kotlin/com/ionspin/kotlin/crypto/SRNG.kt +++ b/multiplatform-crypto-delegated/src/jsMain/kotlin/com/ionspin/kotlin/crypto/SRNG.kt @@ -25,7 +25,7 @@ import org.khronos.webgl.get */ actual object SRNG { var counter = 0 - @ExperimentalUnsignedTypes + actual fun getRandomBytes(amount: Int): UByteArray { val randomBytes = getSodium().randombytes_buf(amount) println("Random bytes: $randomBytes") diff --git a/multiplatform-crypto-delegated/src/jsMain/kotlin/com/ionspin/kotlin/crypto/hash/blake2b/Blake2bDelegated.kt b/multiplatform-crypto-delegated/src/jsMain/kotlin/com/ionspin/kotlin/crypto/hash/blake2b/Blake2bDelegated.kt index 9962f7f..4d10648 100644 --- a/multiplatform-crypto-delegated/src/jsMain/kotlin/com/ionspin/kotlin/crypto/hash/blake2b/Blake2bDelegated.kt +++ b/multiplatform-crypto-delegated/src/jsMain/kotlin/com/ionspin/kotlin/crypto/hash/blake2b/Blake2bDelegated.kt @@ -9,7 +9,7 @@ import com.ionspin.kotlin.crypto.util.toHexString * on 14-Jul-2019 */ -@ExperimentalUnsignedTypes + actual class Blake2bDelegated actual constructor(key: UByteArray?, hashLength: Int) : Blake2b { override val MAX_HASH_BYTES: Int = 64 @@ -31,8 +31,8 @@ actual class Blake2bDelegated actual constructor(key: UByteArray?, hashLength: I } } -@ExperimentalStdlibApi -@ExperimentalUnsignedTypes + + actual object Blake2bStateless : Blake2bStatelessInterface { override val MAX_HASH_BYTES: Int = 64 diff --git a/multiplatform-crypto-delegated/src/jsTest/kotlin/com/ionspin/kotlin/crypto/SRNGJsTest.kt b/multiplatform-crypto-delegated/src/jsTest/kotlin/com/ionspin/kotlin/crypto/SRNGJsTest.kt index 761d25f..c2b1d5f 100644 --- a/multiplatform-crypto-delegated/src/jsTest/kotlin/com/ionspin/kotlin/crypto/SRNGJsTest.kt +++ b/multiplatform-crypto-delegated/src/jsTest/kotlin/com/ionspin/kotlin/crypto/SRNGJsTest.kt @@ -26,7 +26,7 @@ import kotlin.test.assertTrue * ugljesa.jovanovic@ionspin.com * on 05-Jan-2020 */ -@ExperimentalUnsignedTypes + class SRNGJsTest { @Test diff --git a/multiplatform-crypto-delegated/src/jsTest/kotlin/com/ionspin/kotlin/crypto/hash/blake2b/Blake2bJsTest.kt b/multiplatform-crypto-delegated/src/jsTest/kotlin/com/ionspin/kotlin/crypto/hash/blake2b/Blake2bJsTest.kt index 42b51c9..6b9fa66 100644 --- a/multiplatform-crypto-delegated/src/jsTest/kotlin/com/ionspin/kotlin/crypto/hash/blake2b/Blake2bJsTest.kt +++ b/multiplatform-crypto-delegated/src/jsTest/kotlin/com/ionspin/kotlin/crypto/hash/blake2b/Blake2bJsTest.kt @@ -12,8 +12,8 @@ import kotlin.test.assertEquals * ugljesa.jovanovic@ionspin.com * on 25-May-2020 */ -@ExperimentalUnsignedTypes -@ExperimentalStdlibApi + + class Blake2bJsTest { @Test diff --git a/multiplatform-crypto-delegated/src/jvmMain/kotlin/com/ionspin/kotlin/crypto/SRNG.kt b/multiplatform-crypto-delegated/src/jvmMain/kotlin/com/ionspin/kotlin/crypto/SRNG.kt index 05b6419..d136901 100644 --- a/multiplatform-crypto-delegated/src/jvmMain/kotlin/com/ionspin/kotlin/crypto/SRNG.kt +++ b/multiplatform-crypto-delegated/src/jvmMain/kotlin/com/ionspin/kotlin/crypto/SRNG.kt @@ -23,7 +23,7 @@ import java.security.SecureRandom * ugljesa.jovanovic@ionspin.com * on 21-Sep-2019 */ -@ExperimentalUnsignedTypes + actual object SRNG { val secureRandom = SecureRandom() actual fun getRandomBytes(amount: Int): UByteArray { diff --git a/multiplatform-crypto-delegated/src/jvmMain/kotlin/com/ionspin/kotlin/crypto/hash/blake2b/Blake2bDelegated.kt b/multiplatform-crypto-delegated/src/jvmMain/kotlin/com/ionspin/kotlin/crypto/hash/blake2b/Blake2bDelegated.kt index 9be1ed1..f8e640e 100644 --- a/multiplatform-crypto-delegated/src/jvmMain/kotlin/com/ionspin/kotlin/crypto/hash/blake2b/Blake2bDelegated.kt +++ b/multiplatform-crypto-delegated/src/jvmMain/kotlin/com/ionspin/kotlin/crypto/hash/blake2b/Blake2bDelegated.kt @@ -6,7 +6,7 @@ package com.ionspin.kotlin.crypto.hash.blake2b * on 14-Jul-2019 */ -@ExperimentalUnsignedTypes + actual class Blake2bDelegated actual constructor(key: UByteArray?, hashLength: Int) : Blake2b { override val MAX_HASH_BYTES: Int get() = TODO("not implemented yet") @@ -27,7 +27,7 @@ actual class Blake2bDelegated actual constructor(key: UByteArray?, hashLength: I TODO("not implemented yet") } } -@ExperimentalUnsignedTypes + actual object Blake2bStateless : Blake2bStatelessInterface { diff --git a/multiplatform-crypto-delegated/src/native32Main/kotlin/com/ionspin/kotlin/crypto/hash/blake2b/Blake2bDelegated.kt b/multiplatform-crypto-delegated/src/native32Main/kotlin/com/ionspin/kotlin/crypto/hash/blake2b/Blake2bDelegated.kt index 03dc5fa..9a2c49b 100644 --- a/multiplatform-crypto-delegated/src/native32Main/kotlin/com/ionspin/kotlin/crypto/hash/blake2b/Blake2bDelegated.kt +++ b/multiplatform-crypto-delegated/src/native32Main/kotlin/com/ionspin/kotlin/crypto/hash/blake2b/Blake2bDelegated.kt @@ -8,7 +8,7 @@ import libsodium.* * on 14-Jul-2019 */ -@ExperimentalUnsignedTypes + actual class Blake2bDelegated actual constructor(key: UByteArray?, hashLength: Int) : Blake2b { override val MAX_HASH_BYTES: Int = 64 diff --git a/multiplatform-crypto-delegated/src/nativeMain/kotlin/com/ionspin/kotlin/crypto/hash/blake2b/Blake2bDelegated.kt b/multiplatform-crypto-delegated/src/nativeMain/kotlin/com/ionspin/kotlin/crypto/hash/blake2b/Blake2bDelegated.kt index 2149d4a..7394336 100644 --- a/multiplatform-crypto-delegated/src/nativeMain/kotlin/com/ionspin/kotlin/crypto/hash/blake2b/Blake2bDelegated.kt +++ b/multiplatform-crypto-delegated/src/nativeMain/kotlin/com/ionspin/kotlin/crypto/hash/blake2b/Blake2bDelegated.kt @@ -8,7 +8,7 @@ import libsodium.* * on 14-Jul-2019 */ -@ExperimentalUnsignedTypes + actual class Blake2bDelegated actual constructor(key: UByteArray?, hashLength: Int) : Blake2b { override val MAX_HASH_BYTES: Int = 64 diff --git a/multiplatform-crypto/src/commonMain/kotlin/com/ionspin/kotlin/crypto/hash/blake2b/Blake2bPure.kt b/multiplatform-crypto/src/commonMain/kotlin/com/ionspin/kotlin/crypto/hash/blake2b/Blake2bPure.kt index 5ad92b8..a9d6a0d 100644 --- a/multiplatform-crypto/src/commonMain/kotlin/com/ionspin/kotlin/crypto/hash/blake2b/Blake2bPure.kt +++ b/multiplatform-crypto/src/commonMain/kotlin/com/ionspin/kotlin/crypto/hash/blake2b/Blake2bPure.kt @@ -27,7 +27,7 @@ import com.ionspin.kotlin.crypto.util.rotateRight * on 14-Jul-2019 */ -@ExperimentalUnsignedTypes + class Blake2bPure(val key: UByteArray? = null, val hashLength: Int = 64) : Blake2b { companion object : Blake2bStatelessInterface { @@ -144,7 +144,7 @@ class Blake2bPure(val key: UByteArray? = null, val hashLength: Int = 64) : Blake return h } - @ExperimentalStdlibApi + override fun digest(inputString: String, key: String?, hashLength: Int): UByteArray { val array = inputString.encodeToByteArray().toUByteArray() val keyBytes = key?.run { @@ -243,7 +243,7 @@ class Blake2bPure(val key: UByteArray? = null, val hashLength: Int = 64) : Blake } } - @ExperimentalStdlibApi + constructor( key: String?, requestedHashLenght: Int = 64 @@ -308,7 +308,7 @@ class Blake2bPure(val key: UByteArray? = null, val hashLength: Int = 64) : Blake } } - @ExperimentalStdlibApi + override fun update(data: String) { update(data.encodeToByteArray().toUByteArray()) } diff --git a/multiplatform-crypto/src/commonMain/kotlin/com/ionspin/kotlin/crypto/hash/sha/Sha256Pure.kt b/multiplatform-crypto/src/commonMain/kotlin/com/ionspin/kotlin/crypto/hash/sha/Sha256Pure.kt index ec646c1..ae0c04b 100644 --- a/multiplatform-crypto/src/commonMain/kotlin/com/ionspin/kotlin/crypto/hash/sha/Sha256Pure.kt +++ b/multiplatform-crypto/src/commonMain/kotlin/com/ionspin/kotlin/crypto/hash/sha/Sha256Pure.kt @@ -28,7 +28,7 @@ import com.ionspin.kotlin.crypto.util.rotateRight */ -@ExperimentalUnsignedTypes + class Sha256Pure : Sha256 { override val MAX_HASH_BYTES: Int = 32 @@ -65,7 +65,7 @@ class Sha256Pure : Sha256 { 0x748f82eeU, 0x78a5636fU, 0x84c87814U, 0x8cc70208U, 0x90befffaU, 0xa4506cebU, 0xbef9a3f7U, 0xc67178f2U ) - @ExperimentalStdlibApi + override fun digest(inputString: String, key: String?, hashLength: Int): UByteArray { return digest( inputString.encodeToByteArray().toUByteArray(), @@ -243,7 +243,7 @@ class Sha256Pure : Sha256 { var bufferCounter = 0 var buffer = UByteArray(BLOCK_SIZE_IN_BYTES) { 0U } - @ExperimentalStdlibApi + override fun update(data: String) { return update(data.encodeToByteArray().toUByteArray()) } diff --git a/multiplatform-crypto/src/commonMain/kotlin/com/ionspin/kotlin/crypto/hash/sha/Sha512Pure.kt b/multiplatform-crypto/src/commonMain/kotlin/com/ionspin/kotlin/crypto/hash/sha/Sha512Pure.kt index 955ee61..0e16e1a 100644 --- a/multiplatform-crypto/src/commonMain/kotlin/com/ionspin/kotlin/crypto/hash/sha/Sha512Pure.kt +++ b/multiplatform-crypto/src/commonMain/kotlin/com/ionspin/kotlin/crypto/hash/sha/Sha512Pure.kt @@ -26,7 +26,7 @@ import com.ionspin.kotlin.crypto.util.rotateRight * on 18-Jul-2019 */ -@ExperimentalUnsignedTypes + class Sha512Pure : Sha512 { override val MAX_HASH_BYTES: Int = 32 @@ -133,7 +133,7 @@ class Sha512Pure : Sha512 { 0x5be0cd19137e2179UL ) - @ExperimentalStdlibApi + override fun digest(inputString: String, key: String?, hashLength: Int): UByteArray { return digest( inputString.encodeToByteArray().toUByteArray(), @@ -318,7 +318,7 @@ class Sha512Pure : Sha512 { var bufferCounter = 0 var buffer = UByteArray(BLOCK_SIZE_IN_BYTES) { 0U } - @ExperimentalStdlibApi + override fun update(data: String) { return update(data.encodeToByteArray().toUByteArray()) } diff --git a/multiplatform-crypto/src/commonMain/kotlin/com/ionspin/kotlin/crypto/keyderivation/argon2/Argon2Pure.kt b/multiplatform-crypto/src/commonMain/kotlin/com/ionspin/kotlin/crypto/keyderivation/argon2/Argon2Pure.kt index dc94602..1d98291 100644 --- a/multiplatform-crypto/src/commonMain/kotlin/com/ionspin/kotlin/crypto/keyderivation/argon2/Argon2Pure.kt +++ b/multiplatform-crypto/src/commonMain/kotlin/com/ionspin/kotlin/crypto/keyderivation/argon2/Argon2Pure.kt @@ -53,7 +53,7 @@ data class ArgonResult( -@ExperimentalStdlibApi + class Argon2Pure( private val password: UByteArray, private val salt: UByteArray = ubyteArrayOf(), diff --git a/multiplatform-crypto/src/commonMain/kotlin/com/ionspin/kotlin/crypto/keyderivation/argon2/Argon2Utils.kt b/multiplatform-crypto/src/commonMain/kotlin/com/ionspin/kotlin/crypto/keyderivation/argon2/Argon2Utils.kt index 5744082..9647d7f 100644 --- a/multiplatform-crypto/src/commonMain/kotlin/com/ionspin/kotlin/crypto/keyderivation/argon2/Argon2Utils.kt +++ b/multiplatform-crypto/src/commonMain/kotlin/com/ionspin/kotlin/crypto/keyderivation/argon2/Argon2Utils.kt @@ -161,7 +161,7 @@ object Argon2Utils { // ------------ Arithmetic and other utils -@ExperimentalUnsignedTypes + fun UByteArray.xorWithBlock(other : ArgonMatrix, rowPosition: Int, columnPosition: Int) : UByteArray { return UByteArray(BLOCK_SIZE) { this[it] xor other[rowPosition, columnPosition, it] } } \ No newline at end of file diff --git a/multiplatform-crypto/src/commonMain/kotlin/com/ionspin/kotlin/crypto/symmetric/AesCbcPure.kt b/multiplatform-crypto/src/commonMain/kotlin/com/ionspin/kotlin/crypto/symmetric/AesCbcPure.kt index 8b96fc5..134b671 100644 --- a/multiplatform-crypto/src/commonMain/kotlin/com/ionspin/kotlin/crypto/symmetric/AesCbcPure.kt +++ b/multiplatform-crypto/src/commonMain/kotlin/com/ionspin/kotlin/crypto/symmetric/AesCbcPure.kt @@ -30,7 +30,7 @@ import com.ionspin.kotlin.crypto.util.xor * ugljesa.jovanovic@ionspin.com * on 21-Sep-2019 */ -@ExperimentalUnsignedTypes + class AesCbcPure internal constructor(val aesKey: AesKey, val mode: Mode, initializationVector: UByteArray? = null) { companion object { @@ -219,7 +219,7 @@ class AesCbcPure internal constructor(val aesKey: AesKey, val mode: Mode, initia } -@ExperimentalUnsignedTypes + data class EncryptedDataAndInitializationVector(val encryptedData : UByteArray, val initilizationVector : UByteArray) { override fun equals(other: Any?): Boolean { if (this === other) return true diff --git a/multiplatform-crypto/src/commonMain/kotlin/com/ionspin/kotlin/crypto/symmetric/AesCtrPure.kt b/multiplatform-crypto/src/commonMain/kotlin/com/ionspin/kotlin/crypto/symmetric/AesCtrPure.kt index eb18ed3..6c2aa51 100644 --- a/multiplatform-crypto/src/commonMain/kotlin/com/ionspin/kotlin/crypto/symmetric/AesCtrPure.kt +++ b/multiplatform-crypto/src/commonMain/kotlin/com/ionspin/kotlin/crypto/symmetric/AesCtrPure.kt @@ -35,7 +35,7 @@ import com.ionspin.kotlin.crypto.util.xor * ugljesa.jovanovic@ionspin.com * on 22-Sep-2019 */ -@ExperimentalUnsignedTypes + class AesCtrPure internal constructor(val aesKey: AesKey, val mode: Mode, initialCounter: UByteArray? = null) { companion object { @@ -186,7 +186,7 @@ class AesCtrPure internal constructor(val aesKey: AesKey, val mode: Mode, initia } -@ExperimentalUnsignedTypes + data class EncryptedDataAndInitialCounter(val encryptedData : UByteArray, val initialCounter : UByteArray) { override fun equals(other: Any?): Boolean { if (this === other) return true diff --git a/multiplatform-crypto/src/commonMain/kotlin/com/ionspin/kotlin/crypto/symmetric/AesPure.kt b/multiplatform-crypto/src/commonMain/kotlin/com/ionspin/kotlin/crypto/symmetric/AesPure.kt index b4f8807..86ea0eb 100644 --- a/multiplatform-crypto/src/commonMain/kotlin/com/ionspin/kotlin/crypto/symmetric/AesPure.kt +++ b/multiplatform-crypto/src/commonMain/kotlin/com/ionspin/kotlin/crypto/symmetric/AesPure.kt @@ -5,7 +5,7 @@ import com.ionspin.kotlin.crypto.util.flattenToUByteArray /** * Created by Ugljesa Jovanovic (jovanovic.ugljesa@gmail.com) on 07/Sep/2019 */ -@ExperimentalUnsignedTypes + internal class AesPure internal constructor(val aesKey: AesKey, val input: UByteArray) { companion object { private val debug = false diff --git a/multiplatform-crypto/src/commonMain/kotlin/com/ionspin/kotlin/crypto/util/Util.kt b/multiplatform-crypto/src/commonMain/kotlin/com/ionspin/kotlin/crypto/util/Util.kt index abb6010..28e9232 100644 --- a/multiplatform-crypto/src/commonMain/kotlin/com/ionspin/kotlin/crypto/util/Util.kt +++ b/multiplatform-crypto/src/commonMain/kotlin/com/ionspin/kotlin/crypto/util/Util.kt @@ -62,17 +62,17 @@ inline fun Array.chunked(sliceSize: Int): Array> { } -@ExperimentalUnsignedTypes + infix fun UInt.rotateRight(places: Int): UInt { return (this shr places) xor (this shl (32 - places)) } -@ExperimentalUnsignedTypes + infix fun ULong.rotateRight(places: Int): ULong { return (this shr places) xor (this shl (64 - places)) } -@ExperimentalUnsignedTypes + infix fun Array.xor(other : Array) : Array { if (this.size != other.size) { throw RuntimeException("Operands of different sizes are not supported yet") @@ -80,7 +80,7 @@ infix fun Array.xor(other : Array) : Array { return Array(this.size) { this[it] xor other[it] } } -@ExperimentalUnsignedTypes + infix fun UByteArray.xor(other : UByteArray) : UByteArray { if (this.size != other.size) { throw RuntimeException("Operands of different sizes are not supported yet") @@ -88,17 +88,17 @@ infix fun UByteArray.xor(other : UByteArray) : UByteArray { return UByteArray(this.size) { this[it] xor other[it] } } -@ExperimentalUnsignedTypes + fun String.hexStringToTypedUByteArray() : Array { return this.chunked(2).map { it.toUByte(16) }.toTypedArray() } -@ExperimentalUnsignedTypes + fun String.hexStringToUByteArray() : UByteArray { return this.chunked(2).map { it.toUByte(16) }.toUByteArray() } -@ExperimentalUnsignedTypes + fun Array.toHexString() : String { return this.joinToString(separator = "") { if (it <= 0x0FU) { @@ -109,7 +109,7 @@ fun Array.toHexString() : String { } } -@ExperimentalUnsignedTypes + fun UByteArray.toHexString() : String { return this.joinToString(separator = "") { if (it <= 0x0FU) { @@ -121,20 +121,20 @@ fun UByteArray.toHexString() : String { } // UInt / Array utils -@ExperimentalUnsignedTypes + fun UInt.toBigEndianUByteArray() : Array { return Array (4) { ((this shr (24 - (it * 8))) and 0xFFU).toUByte() } } -@ExperimentalUnsignedTypes + fun UInt.toLittleEndianTypedUByteArray() : Array { return Array (4) { ((this shr (it * 8)) and 0xFFU).toUByte() } } -@ExperimentalUnsignedTypes + fun UInt.toLittleEndianUByteArray() : UByteArray { return UByteArray (4) { ((this shr (it * 8)) and 0xFFU).toUByte() @@ -142,27 +142,27 @@ fun UInt.toLittleEndianUByteArray() : UByteArray { } // UInt / Array utils -@ExperimentalUnsignedTypes + fun ULong.toBigEndianUByteArray() : Array { return Array (8) { ((this shr (56 - (it * 8))) and 0xFFU).toUByte() } } -@ExperimentalUnsignedTypes + fun ULong.toLittleEndianTypedUByteArray() : Array { return Array (8) { ((this shr (it * 8)) and 0xFFU).toUByte() } } -@ExperimentalUnsignedTypes + fun ULong.toLittleEndianUByteArray() :UByteArray { return UByteArray (8) { ((this shr (it * 8)) and 0xFFU).toUByte() } } -@ExperimentalUnsignedTypes + fun Array.fromLittleEndianArrayToULong() : ULong { if (this.size > 8) { throw RuntimeException("ore than 8 bytes in input, potential overflow") @@ -171,7 +171,7 @@ fun Array.fromLittleEndianArrayToULong() : ULong { return ulong } -@ExperimentalUnsignedTypes + fun UByteArray.fromLittleEndianArrayToULong() : ULong { if (this.size > 8) { throw RuntimeException("ore than 8 bytes in input, potential overflow") @@ -199,7 +199,7 @@ fun UByteArray.arrayChunked(sliceSize: Int): List { } -@ExperimentalUnsignedTypes + fun Array.fromBigEndianArrayToULong() : ULong { if (this.size > 8) { throw RuntimeException("ore than 8 bytes in input, potential overflow") @@ -213,7 +213,7 @@ fun Array.fromBigEndianArrayToULong() : ULong { return ulong } -@ExperimentalUnsignedTypes + fun Array.fromLittleEndianArrayToUInt() : UInt { if (this.size > 4) { throw RuntimeException("ore than 8 bytes in input, potential overflow") @@ -222,7 +222,7 @@ fun Array.fromLittleEndianArrayToUInt() : UInt { return uint } -@ExperimentalUnsignedTypes + fun UByteArray.fromLittleEndianArrayToUInt() : UInt { if (this.size > 4) { throw RuntimeException("ore than 8 bytes in input, potential overflow") @@ -234,7 +234,7 @@ fun UByteArray.fromLittleEndianArrayToUInt() : UInt { -@ExperimentalUnsignedTypes + fun Array.fromBigEndianArrayToUInt() : UInt { if (this.size > 4) { throw RuntimeException("ore than 8 bytes in input, potential overflow") @@ -243,7 +243,7 @@ fun Array.fromBigEndianArrayToUInt() : UInt { return uint } -@ExperimentalUnsignedTypes + operator fun UInt.plus(other : UByteArray) : UByteArray { return this.toLittleEndianUByteArray() + other } diff --git a/multiplatform-crypto/src/commonTest/kotlin/com/ionspin/kotlin/crypto/ReadmeTest.kt b/multiplatform-crypto/src/commonTest/kotlin/com/ionspin/kotlin/crypto/ReadmeTest.kt index 51808f6..2e73f27 100644 --- a/multiplatform-crypto/src/commonTest/kotlin/com/ionspin/kotlin/crypto/ReadmeTest.kt +++ b/multiplatform-crypto/src/commonTest/kotlin/com/ionspin/kotlin/crypto/ReadmeTest.kt @@ -34,8 +34,8 @@ import kotlin.time.measureTime * ugljesa.jovanovic@ionspin.com * on 20-Jul-2019 */ -@ExperimentalUnsignedTypes -@ExperimentalStdlibApi + + class ReadmeTest { @Test @@ -76,7 +76,7 @@ class ReadmeTest { } } - @ExperimentalStdlibApi + @Test fun sha256Example() { val input = "abc" @@ -89,7 +89,7 @@ class ReadmeTest { } - @ExperimentalStdlibApi + @Test fun sha512Example() { val input = "abc" @@ -104,7 +104,7 @@ class ReadmeTest { } - @ExperimentalStdlibApi + @Test fun sha256UpdatableExample() { val sha256 = Sha256Pure() @@ -116,7 +116,7 @@ class ReadmeTest { } } - @ExperimentalStdlibApi + @Test fun sha512UpdatableExample() { val sha512 = Sha512Pure() diff --git a/multiplatform-crypto/src/commonTest/kotlin/com/ionspin/kotlin/crypto/hash/argon/Argon2KATTest.kt b/multiplatform-crypto/src/commonTest/kotlin/com/ionspin/kotlin/crypto/hash/argon/Argon2KATTest.kt index 6d73b4b..6e86d56 100644 --- a/multiplatform-crypto/src/commonTest/kotlin/com/ionspin/kotlin/crypto/hash/argon/Argon2KATTest.kt +++ b/multiplatform-crypto/src/commonTest/kotlin/com/ionspin/kotlin/crypto/hash/argon/Argon2KATTest.kt @@ -30,7 +30,7 @@ import kotlin.test.assertTrue * ugljesa.jovanovic@ionspin.com * on 10-May-2020 */ -@ExperimentalStdlibApi + class Argon2KATTest { @Test diff --git a/multiplatform-crypto/src/commonTest/kotlin/com/ionspin/kotlin/crypto/hash/blake2b/Blake2BTest.kt b/multiplatform-crypto/src/commonTest/kotlin/com/ionspin/kotlin/crypto/hash/blake2b/Blake2BTest.kt index c1dce9e..5fdb28e 100644 --- a/multiplatform-crypto/src/commonTest/kotlin/com/ionspin/kotlin/crypto/hash/blake2b/Blake2BTest.kt +++ b/multiplatform-crypto/src/commonTest/kotlin/com/ionspin/kotlin/crypto/hash/blake2b/Blake2BTest.kt @@ -25,8 +25,8 @@ import kotlin.test.assertTrue * ugljesa.jovanovic@ionspin.com * on 14-Jul-2019 */ -@ExperimentalUnsignedTypes -@ExperimentalStdlibApi + + class Blake2BTest { @Test diff --git a/multiplatform-crypto/src/commonTest/kotlin/com/ionspin/kotlin/crypto/hash/blake2b/Blake2bInstanceTest.kt b/multiplatform-crypto/src/commonTest/kotlin/com/ionspin/kotlin/crypto/hash/blake2b/Blake2bInstanceTest.kt index fbf73cb..308b0cc 100644 --- a/multiplatform-crypto/src/commonTest/kotlin/com/ionspin/kotlin/crypto/hash/blake2b/Blake2bInstanceTest.kt +++ b/multiplatform-crypto/src/commonTest/kotlin/com/ionspin/kotlin/crypto/hash/blake2b/Blake2bInstanceTest.kt @@ -24,8 +24,8 @@ import kotlin.test.assertTrue * ugljesa.jovanovic@ionspin.com * on 20-Jul-2019 */ -@ExperimentalUnsignedTypes -@ExperimentalStdlibApi + + class Blake2bInstanceTest { @Test diff --git a/multiplatform-crypto/src/commonTest/kotlin/com/ionspin/kotlin/crypto/hash/blake2b/Blake2bKnowAnswerTests.kt b/multiplatform-crypto/src/commonTest/kotlin/com/ionspin/kotlin/crypto/hash/blake2b/Blake2bKnowAnswerTests.kt index 194fce5..ab3dc88 100644 --- a/multiplatform-crypto/src/commonTest/kotlin/com/ionspin/kotlin/crypto/hash/blake2b/Blake2bKnowAnswerTests.kt +++ b/multiplatform-crypto/src/commonTest/kotlin/com/ionspin/kotlin/crypto/hash/blake2b/Blake2bKnowAnswerTests.kt @@ -30,8 +30,8 @@ data class KnownAnswerTest( val hash: String ) -@ExperimentalUnsignedTypes -@ExperimentalStdlibApi + + class Blake2bKnowAnswerTests { @Test fun knownAnswerTest() { diff --git a/multiplatform-crypto/src/commonTest/kotlin/com/ionspin/kotlin/crypto/hash/sha/Sha256Test.kt b/multiplatform-crypto/src/commonTest/kotlin/com/ionspin/kotlin/crypto/hash/sha/Sha256Test.kt index b82bc13..6b6943f 100644 --- a/multiplatform-crypto/src/commonTest/kotlin/com/ionspin/kotlin/crypto/hash/sha/Sha256Test.kt +++ b/multiplatform-crypto/src/commonTest/kotlin/com/ionspin/kotlin/crypto/hash/sha/Sha256Test.kt @@ -24,10 +24,10 @@ import kotlin.test.assertTrue * ugljesa.jovanovic@ionspin.com * on 17-Jul-2019 */ -@ExperimentalUnsignedTypes + class Sha256Test { - @ExperimentalStdlibApi + @Test fun testWellKnownValue() { @@ -40,7 +40,7 @@ class Sha256Test { } - @ExperimentalStdlibApi + @Test fun testWellKnownDoubleBlock() { @@ -51,7 +51,7 @@ class Sha256Test { } } - @ExperimentalStdlibApi + @Test fun testWellKnown3() { //It's good that I'm consistent with names. @@ -64,7 +64,7 @@ class Sha256Test { } } - @ExperimentalStdlibApi + @Test fun testWellKnownLong() { val inputBuilder = StringBuilder() diff --git a/multiplatform-crypto/src/commonTest/kotlin/com/ionspin/kotlin/crypto/hash/sha/Sha256UpdateableTest.kt b/multiplatform-crypto/src/commonTest/kotlin/com/ionspin/kotlin/crypto/hash/sha/Sha256UpdateableTest.kt index 0bdcd0d..8e94be5 100644 --- a/multiplatform-crypto/src/commonTest/kotlin/com/ionspin/kotlin/crypto/hash/sha/Sha256UpdateableTest.kt +++ b/multiplatform-crypto/src/commonTest/kotlin/com/ionspin/kotlin/crypto/hash/sha/Sha256UpdateableTest.kt @@ -25,10 +25,10 @@ import kotlin.test.assertTrue * ugljesa.jovanovic@ionspin.com * on 17-Jul-2019 */ -@ExperimentalUnsignedTypes + class Sha256UpdatableTest { - @ExperimentalStdlibApi + @Test fun testWellKnownValue() { val sha256 = Sha256Pure() @@ -40,7 +40,7 @@ class Sha256UpdatableTest { } } - @ExperimentalStdlibApi + @Test fun testWellKnownDoubleBlock() { val sha256 = Sha256Pure() @@ -53,7 +53,7 @@ class Sha256UpdatableTest { } } - @ExperimentalStdlibApi + @Test fun testWellKnown3() { //It's good that I'm consistent with names. val sha256 = Sha256Pure() @@ -66,7 +66,7 @@ class Sha256UpdatableTest { } } - @ExperimentalStdlibApi + @Test fun testWellKnownLong() { val sha256 = Sha256Pure() @@ -81,7 +81,7 @@ class Sha256UpdatableTest { } @Ignore() - @ExperimentalStdlibApi + @Test fun testWellKnownLonger() { val sha256 = Sha256Pure() diff --git a/multiplatform-crypto/src/commonTest/kotlin/com/ionspin/kotlin/crypto/hash/sha/Sha512Test.kt b/multiplatform-crypto/src/commonTest/kotlin/com/ionspin/kotlin/crypto/hash/sha/Sha512Test.kt index 910b36f..18ac132 100644 --- a/multiplatform-crypto/src/commonTest/kotlin/com/ionspin/kotlin/crypto/hash/sha/Sha512Test.kt +++ b/multiplatform-crypto/src/commonTest/kotlin/com/ionspin/kotlin/crypto/hash/sha/Sha512Test.kt @@ -26,7 +26,7 @@ import kotlin.test.assertTrue */ class Sha512Test { - @ExperimentalStdlibApi + @Test fun testWellKnownValue() { @@ -41,8 +41,8 @@ class Sha512Test { } - @ExperimentalUnsignedTypes - @ExperimentalStdlibApi + + @Test fun testWellKnown3() { val sha512 = Sha512Pure() @@ -55,7 +55,7 @@ class Sha512Test { } } - @ExperimentalStdlibApi + @Test fun testWellKnownLong() { val inputBuilder = StringBuilder() diff --git a/multiplatform-crypto/src/commonTest/kotlin/com/ionspin/kotlin/crypto/hash/sha/Sha512UpdateableTest.kt b/multiplatform-crypto/src/commonTest/kotlin/com/ionspin/kotlin/crypto/hash/sha/Sha512UpdateableTest.kt index dc70563..3ea6e0c 100644 --- a/multiplatform-crypto/src/commonTest/kotlin/com/ionspin/kotlin/crypto/hash/sha/Sha512UpdateableTest.kt +++ b/multiplatform-crypto/src/commonTest/kotlin/com/ionspin/kotlin/crypto/hash/sha/Sha512UpdateableTest.kt @@ -26,7 +26,7 @@ import kotlin.test.assertTrue * on 21-Jul-2019 */ class Sha512UpdatableTest { - @ExperimentalStdlibApi + @Test fun testWellKnownValue() { val sha512 = Sha512Pure() @@ -41,7 +41,7 @@ class Sha512UpdatableTest { } - @ExperimentalStdlibApi + @Test fun testWellKnownDoubleBlock() { val sha512 = Sha512Pure() @@ -55,7 +55,7 @@ class Sha512UpdatableTest { } } - @ExperimentalStdlibApi + @Test fun testWellKnownLong() { val sha512 = Sha512Pure() @@ -70,7 +70,7 @@ class Sha512UpdatableTest { } @Ignore() //Interestingly enough I'm not the only one having trouble with this test. - @ExperimentalStdlibApi + @Test fun testWellKnownLonger() { val sha512 = Sha512Pure() diff --git a/multiplatform-crypto/src/commonTest/kotlin/com/ionspin/kotlin/crypto/symmetric/AesCbcTest.kt b/multiplatform-crypto/src/commonTest/kotlin/com/ionspin/kotlin/crypto/symmetric/AesCbcTest.kt index 0a560d1..4196616 100644 --- a/multiplatform-crypto/src/commonTest/kotlin/com/ionspin/kotlin/crypto/symmetric/AesCbcTest.kt +++ b/multiplatform-crypto/src/commonTest/kotlin/com/ionspin/kotlin/crypto/symmetric/AesCbcTest.kt @@ -26,7 +26,7 @@ import kotlin.test.assertTrue * ugljesa.jovanovic@ionspin.com * on 21-Sep-2019 */ -@ExperimentalUnsignedTypes + class AesCbcTest { @Test diff --git a/multiplatform-crypto/src/commonTest/kotlin/com/ionspin/kotlin/crypto/symmetric/AesCtrTest.kt b/multiplatform-crypto/src/commonTest/kotlin/com/ionspin/kotlin/crypto/symmetric/AesCtrTest.kt index 5a07619..480374a 100644 --- a/multiplatform-crypto/src/commonTest/kotlin/com/ionspin/kotlin/crypto/symmetric/AesCtrTest.kt +++ b/multiplatform-crypto/src/commonTest/kotlin/com/ionspin/kotlin/crypto/symmetric/AesCtrTest.kt @@ -26,7 +26,7 @@ import kotlin.test.assertTrue * ugljesa.jovanovic@ionspin.com * on 21-Sep-2019 */ -@ExperimentalUnsignedTypes + class AesCtrTest { @Test diff --git a/multiplatform-crypto/src/commonTest/kotlin/com/ionspin/kotlin/crypto/symmetric/AesTest.kt b/multiplatform-crypto/src/commonTest/kotlin/com/ionspin/kotlin/crypto/symmetric/AesTest.kt index 4424296..e733cb0 100644 --- a/multiplatform-crypto/src/commonTest/kotlin/com/ionspin/kotlin/crypto/symmetric/AesTest.kt +++ b/multiplatform-crypto/src/commonTest/kotlin/com/ionspin/kotlin/crypto/symmetric/AesTest.kt @@ -6,7 +6,7 @@ import kotlin.test.assertTrue /** * Created by Ugljesa Jovanovic (jovanovic.ugljesa@gmail.com) on 10/Sep/2019 */ -@ExperimentalUnsignedTypes + class AesTest { val irrelevantKey = "01234567890123345678901234567890" diff --git a/multiplatform-crypto/src/commonTest/kotlin/com/ionspin/kotlin/crypto/util/UtilTest.kt b/multiplatform-crypto/src/commonTest/kotlin/com/ionspin/kotlin/crypto/util/UtilTest.kt index d038416..a72224d 100644 --- a/multiplatform-crypto/src/commonTest/kotlin/com/ionspin/kotlin/crypto/util/UtilTest.kt +++ b/multiplatform-crypto/src/commonTest/kotlin/com/ionspin/kotlin/crypto/util/UtilTest.kt @@ -24,7 +24,7 @@ import kotlin.test.assertTrue * ugljesa.jovanovic@ionspin.com * on 17-Jul-2019 */ -@ExperimentalUnsignedTypes + class UtilTest { @Test diff --git a/multiplatform-crypto/src/jsMain/kotlin/com/ionspin/kotlin/crypto/SRNG.kt b/multiplatform-crypto/src/jsMain/kotlin/com/ionspin/kotlin/crypto/SRNG.kt index b2de763..d9ddbd0 100644 --- a/multiplatform-crypto/src/jsMain/kotlin/com/ionspin/kotlin/crypto/SRNG.kt +++ b/multiplatform-crypto/src/jsMain/kotlin/com/ionspin/kotlin/crypto/SRNG.kt @@ -25,7 +25,7 @@ import kotlin.browser.window */ actual object SRNG { var counter = 0 - @ExperimentalUnsignedTypes + actual fun getRandomBytes(amount: Int): UByteArray { val runningOnNode = jsTypeOf(window) == "undefined" val randomBytes = if (runningOnNode) { diff --git a/multiplatform-crypto/src/jsTest/kotlin/com/ionspin/kotlin/crypto/SRNGJsTest.kt b/multiplatform-crypto/src/jsTest/kotlin/com/ionspin/kotlin/crypto/SRNGJsTest.kt index 95d5291..594e59f 100644 --- a/multiplatform-crypto/src/jsTest/kotlin/com/ionspin/kotlin/crypto/SRNGJsTest.kt +++ b/multiplatform-crypto/src/jsTest/kotlin/com/ionspin/kotlin/crypto/SRNGJsTest.kt @@ -24,7 +24,7 @@ import kotlin.test.assertTrue * ugljesa.jovanovic@ionspin.com * on 05-Jan-2020 */ -@ExperimentalUnsignedTypes + class SRNGJsTest { @Test diff --git a/multiplatform-crypto/src/jvmMain/kotlin/com/ionspin/kotlin/crypto/SRNG.kt b/multiplatform-crypto/src/jvmMain/kotlin/com/ionspin/kotlin/crypto/SRNG.kt index 05b6419..d136901 100644 --- a/multiplatform-crypto/src/jvmMain/kotlin/com/ionspin/kotlin/crypto/SRNG.kt +++ b/multiplatform-crypto/src/jvmMain/kotlin/com/ionspin/kotlin/crypto/SRNG.kt @@ -23,7 +23,7 @@ import java.security.SecureRandom * ugljesa.jovanovic@ionspin.com * on 21-Sep-2019 */ -@ExperimentalUnsignedTypes + actual object SRNG { val secureRandom = SecureRandom() actual fun getRandomBytes(amount: Int): UByteArray { diff --git a/sample/src/linuxArm32HfpMain/kotlin/com/ionspin/kotlin/crypto/sample/Runner.kt b/sample/src/linuxArm32HfpMain/kotlin/com/ionspin/kotlin/crypto/sample/Runner.kt index bf7b023..2c1979b 100644 --- a/sample/src/linuxArm32HfpMain/kotlin/com/ionspin/kotlin/crypto/sample/Runner.kt +++ b/sample/src/linuxArm32HfpMain/kotlin/com/ionspin/kotlin/crypto/sample/Runner.kt @@ -3,7 +3,7 @@ import kotlin.time.ExperimentalTime import kotlin.time.measureTime @ExperimentalTime -@ExperimentalStdlibApi + fun main() { println("Test") // Blake diff --git a/sample/src/linuxArm64Main/kotlin/com/ionspin/kotlin/crypto/sample/Runner.kt b/sample/src/linuxArm64Main/kotlin/com/ionspin/kotlin/crypto/sample/Runner.kt index 05b946d..b060b83 100644 --- a/sample/src/linuxArm64Main/kotlin/com/ionspin/kotlin/crypto/sample/Runner.kt +++ b/sample/src/linuxArm64Main/kotlin/com/ionspin/kotlin/crypto/sample/Runner.kt @@ -6,7 +6,7 @@ import kotlin.time.ExperimentalTime import kotlin.time.measureTime @ExperimentalTime -@ExperimentalStdlibApi + fun main() = runBlocking { Sample.runSample() // println("Test") diff --git a/sample/src/linuxMain/kotlin/com/ionspin/kotlin/crypto/sample/Runner.kt b/sample/src/linuxMain/kotlin/com/ionspin/kotlin/crypto/sample/Runner.kt index c912f71..75ad5b8 100644 --- a/sample/src/linuxMain/kotlin/com/ionspin/kotlin/crypto/sample/Runner.kt +++ b/sample/src/linuxMain/kotlin/com/ionspin/kotlin/crypto/sample/Runner.kt @@ -4,7 +4,7 @@ import kotlin.time.ExperimentalTime import kotlin.time.measureTime @ExperimentalTime -@ExperimentalStdlibApi + fun main() { println("Test") // Blake