base16

Pure Haskell base16 encoding/decoding (docs.ppad.tech/base16).
git clone git://git.ppad.tech/base16.git
Log | Files | Refs | README | LICENSE

commit 0e26869730d8c417d7f7786275ff59feae661a19
parent 043c845ae7f280ddbfdb5568ea453c9943e49cf2
Author: Jared Tobin <jared@jtobin.io>
Date:   Mon, 10 Mar 2025 20:49:41 +0400

lib: handle uppercase hex chars gracefully

Diffstat:
Mlib/Data/ByteString/Base16.hs | 5+++--
1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/lib/Data/ByteString/Base16.hs b/lib/Data/ByteString/Base16.hs @@ -125,8 +125,9 @@ encode bs@(BI.PS _ _ l) -- word8 hex character to word4 word4 :: Word8 -> Maybe Word8 word4 c - | c > 47 && c < 58 = pure $! c - 48 - | c > 96 && c < 103 = pure $! c - 87 + | c > 47 && c < 58 = pure $! c - 48 -- 0-9 + | c > 64 && c < 71 = pure $! c - 55 -- A-F + | c > 96 && c < 103 = pure $! c - 87 -- a-f | otherwise = Nothing {-# INLINE word4 #-}