Skip to content

Commit

Permalink
Remove @ExperimentalUnsignedTypes usage (UByte)
Browse files Browse the repository at this point in the history
  • Loading branch information
lambdapioneer committed Apr 12, 2020
1 parent 1848258 commit 3964fb2
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions lib/src/main/java/com/lambdapioneer/argon2kt/Utils.kt
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,11 @@ import java.util.*
* Decodes a hexadecimal String. Will throw if it encounters illegal characters (i.e. not 0-9a-fA-F) or if the String
* has an odd length.
*/
@ExperimentalUnsignedTypes
fun String.decodeAsHex(): ByteArray {
checkArgument(this.length % 2 == 0, "A valid hex string must have an even number of characters")

return ByteArray(this.length / 2) {
this.substring(2 * it, 2 * it + 2).toUByte(radix = 16).toByte()
this.substring(2 * it, 2 * it + 2).toInt(radix = 16).toByte()
}
}

Expand Down

0 comments on commit 3964fb2

Please sign in to comment.