base32string-0.9.0: Fast and safe representation of a Base-32 string

Safe HaskellSafe-Inferred
LanguageHaskell2010

Data.Base32String

Synopsis

Documentation

data Base32String Source

Represents a Base32 string. Guarantees that all characters it contains are valid base32 characters.

b32String Source

Arguments

:: ByteString

Our Base32 mapping table

-> ByteString

Our Base32 string

-> Base32String 

Smart constructor which validates that all the text are actually base-32 characters.

fromBinary Source

Arguments

:: Binary a 
=> ByteString

Our Base32 mapping table

-> a

Input object that is convertable to binary

-> Base32String

Base32 representation of binary data

Converts a Binary to a Base32String value

toBinary Source

Arguments

:: Binary a 
=> ByteString

Base32 mapping table

-> Base32String

Base32 representation

-> a

Converted object

Converts a Base32String to a Binary value

fromBytes Source

Arguments

:: ByteString

Our Base32 mapping table

-> ByteString

Raw binary bytes

-> Base32String

Base32 representation of raw binary bytes

Reads a ByteString as raw bytes and converts to base32 representation. We cannot use the instance Binary of ByteString because it provides a leading length, which is not what we want when dealing with raw bytes.

toBytes Source

Arguments

:: ByteString

Base32 mapping table

-> Base32String

Base32 string we wish to get binary data from

-> ByteString

Raw binary representation

Access to the raw bytes in a ByteString format.

toText :: Base32String -> Text Source

Access to a Text representation of the Base32String

fromText Source

Arguments

:: ByteString

Base32 mapping table

-> Text

Text representation

-> Base32String

Base32 classified representation

Converts a Text representation to a Base32String