-- | Module : Data.BaseSystem.Alphabets -- Description : Provides alphabets for common base-encodings -- Copyright : Zoey McBride (c) 2026 -- License : BSD-3-Clause -- Maintainer : zoeymcbride@mailbox.org -- Stability : experimental -- -- Defines common Alphabets for BaseSystems. module Data.BaseSystem.Alphabets ( binary, decimal, hexlower, hexupper, btc58, b32lower, b32upper, b32hexlower, b32hexupper, b64, b64url, ) where import Data.BaseSystem.Alphabet -- | Represents base2. binary :: Alphabet binary = mkAlphabet "01" -- | Represents base10. decimal :: Alphabet decimal = mkAlphabet $ '0' : ['1' .. '9'] -- | Represents base16 w/ upper case A-F. hexupper :: Alphabet hexupper = mkAlphabet $ ['0'] ++ ['1' .. '9'] ++ ['A' .. 'F'] -- | Represents base16 w/ lower case a-f. hexlower :: Alphabet hexlower = mkAlphabet $ ['0'] ++ ['1' .. '9'] ++ ['a' .. 'f'] -- | Represents Bitcoin's base58. btc58 :: Alphabet btc58 = mkAlphabet $ ['1' .. '9'] ++ ['A' .. 'H'] ++ ['J' .. 'N'] ++ ['P' .. 'Z'] ++ ['a' .. 'k'] ++ ['m' .. 'z'] b32lower :: Alphabet b32lower = mkAlphabet $ ['a' .. 'z'] ++ ['2' .. '7'] b32upper :: Alphabet b32upper = mkAlphabet $ ['A' .. 'Z'] ++ ['2' .. '7'] b32hexupper :: Alphabet b32hexupper = mkAlphabet $ ['0'] ++ ['1' .. '9'] ++ ['A' .. 'V'] b32hexlower :: Alphabet b32hexlower = mkAlphabet $ ['0'] ++ ['1' .. '9'] ++ ['a' .. 'v'] -- | Represents base64 w/o padding implemented. b64 :: Alphabet b64 = mkAlphabet $ ['A' .. 'Z'] ++ ['a' .. 'z'] ++ ['0'] ++ ['1' .. '9'] ++ ['+', '/'] -- | Represents base64 w/o padding implemented. b64url :: Alphabet b64url = mkAlphabet $ ['A' .. 'Z'] ++ ['a' .. 'z'] ++ ['0'] ++ ['1' .. '9'] ++ ['-', '_']