fix: UUID string format #1421

This commit is contained in:
J-Jamet committed 2025-08-22 11:37:30 +02:00
1 parent 80b16bccf1
commit 9477fba704
3 files changed
+18 -7

No files matched your search

@@ -24,6 +24,10 @@ import java.util.Locale
import java.util.UUID
object UUIDUtils {
/**
* Specific UUID string format for KeePass database
*/
fun UUID.asHexString(): String? {
try {
val buf = uuidTo16Bytes(this)
@@ -52,6 +56,10 @@ object UUIDUtils {
}
}
/**
* From a specific UUID KeePass database string format,
* Note : For a standard UUID string format, use UUID.fromString()
*/
fun String.asUUID(): UUID? {
if (this.length != 32) return null
@@ -98,10 +106,6 @@ object UUIDUtils {
}.array()
}
fun String.asUUIDBytes(): ByteArray {
return this.asUUID()?.asBytes() ?: ByteArray(16)
}
// Use short to represent unsigned byte
private fun byteToChar(bt: Char): Char {
return if (bt.code >= 10) {