hexstring-0.11.1: Fast and safe representation of a hex string

Safe HaskellNone




data HexString Source

Represents a Hex string. Guarantees that all characters it contains are valid hex characters.

hexString :: ByteString -> HexString Source

Smart constructor which validates that all the text are actually hexadecimal characters.

fromBinary :: Binary a => a -> HexString Source

Converts a Binary to a HexString value

toBinary :: Binary a => HexString -> a Source

Converts a HexString to a Binary value

fromBytes :: ByteString -> HexString Source

Reads a ByteString as raw bytes and converts to hex 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 :: HexString -> ByteString Source

Access to the raw bytes in a ByteString format.

toText :: HexString -> Text Source

Access to a Text representation of the HexString