]> git.codecow.com Git - libnemo.git/commitdiff
Simplify entropy hex regex.
authorChris Duncan <chris@zoso.dev>
Mon, 4 Aug 2025 18:11:42 +0000 (11:11 -0700)
committerChris Duncan <chris@zoso.dev>
Mon, 4 Aug 2025 18:11:42 +0000 (11:11 -0700)
src/lib/entropy.ts

index 5d34ff648bca364f6e9c5099bbc6f627abb9c24a..03df2873d77ed5adc42bb02717cb21e0daf23148 100644 (file)
@@ -90,7 +90,7 @@ export class Entropy {
                        if (input.length % Entropy.#MOD * 2 !== 0) {
                                throw new RangeError(`Entropy must be a multiple of ${Entropy.#MOD * 2} characters`)
                        }
-                       if (!/^[0-9a-fA-F]+$/i.test(input)) {
+                       if (!/^[A-F0-9]+$/i.test(input)) {
                                throw new RangeError('Entropy contains invalid hexadecimal characters')
                        }
                        this.#bytes = hex.toBytes(input)