cold-widow-0.1.2: File transfer via QR Codes.

Safe HaskellSafe
LanguageHaskell2010

Codec.Binary.Coldwidow

Description

QR Code alphanumeric mode accepts a set of 45 characters. This module offers functions to encodedecode binary data tofrom text representation using only the 45 characters allowed by the qr-code alphanumeric mode.

Synopsis

Documentation

encode :: Integer -> String Source #

Encodes binary data into a String. The resulting string will contain only the 45 characters allowed by the qr-code alphanumeric mode. The binary data to be encoded should be represented as a Haskell Integer. To convert a ByteString to a Haskell Integer you can use the packInteger function defined bellow.

decode :: String -> Integer Source #

Decodes binary data from its text representation. The text representation of data, obtained with the encode function defined above, will contain only characters allowed in the qr-code alphanumeric mode. The decoded binary data returned by this function will be represented as a Haskell Integer. To convert it into a BinaryString you can use the unpackInteger function defined bellow.

packInteger :: ByteString -> Integer Source #

Converts a BinaryString to an Integer. This is used to represent binary data as a Haskell Integer tha can be passed to encode function defined above.

unpackInteger :: Integer -> ByteString Source #

Converts a Haskell Integer into a ByteString. The Integer holds the binary represantation of the data you obtain by using the decode function defined above. You can use the ByteString represantation to, for example, save the binary data into a file.