Faster hex validation
This commit is contained in:
@@ -34,29 +34,9 @@ fun HexKey.hexToByteArray(): ByteArray {
|
||||
object HexValidator {
|
||||
private fun isHexChar(c: Char): Boolean {
|
||||
return when (c) {
|
||||
'0',
|
||||
'1',
|
||||
'2',
|
||||
'3',
|
||||
'4',
|
||||
'5',
|
||||
'6',
|
||||
'7',
|
||||
'8',
|
||||
'9',
|
||||
'a',
|
||||
'b',
|
||||
'c',
|
||||
'd',
|
||||
'e',
|
||||
'f',
|
||||
'A',
|
||||
'B',
|
||||
'C',
|
||||
'D',
|
||||
'E',
|
||||
'F',
|
||||
-> true
|
||||
in '0'..'9' -> true
|
||||
in 'a'..'f' -> true
|
||||
in 'A'..'F' -> true
|
||||
else -> false
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user