pgp-wordlist-0.1: Translate between binary data and a human-readable collection of words.

Safe HaskellSafe-Inferred
LanguageHaskell2010

Data.Text.PgpWordlist.Internal.Tables

Description

Core functionality for conversion between binary formats and PGP word lists.

Synopsis

Documentation

newtype PgpWordlist Source

Abstract representation of a PGP word list.

data TranslationError Source

Possible translation errors from a list of PGP words to binary format.

Constructors

BadWord Text

Word is not recognized

BadParity Text Word8

Word is recognized, but from the wrong alphabet. Duplicates, omissions, and neighbour transpositions are often cause for this.

toText :: ByteString -> Text Source

Inverse of fromText, modulo whitespace count.

fromText :: Text -> Either TranslationError ByteString Source

Convert a text of whitespace-separated words to their binary representation. The whitespace splitting behaviour is given by words.

newtype EvenWord Source

Word that is supposed to occur in an even position

Constructors

EvenWord 

Fields

unEvenWord :: Text
 

toEvenWord :: Word8 -> EvenWord Source

Look up the word corresponding to a byte.

fromEvenWord :: Text -> Either TranslationError Word8 Source

Simple conversion, taking into account invalid words.

evenMap :: Bimap Word8 EvenWord Source

Mapping from and to EvenWords

newtype OddWord Source

Word that is supposed to occur in an odd position

Constructors

OddWord 

Fields

unOddWord :: Text
 

toOddWord :: Word8 -> OddWord Source

Look up the word corresponding to a byte.

fromOddWord :: Text -> Either TranslationError Word8 Source

Simple conversion, taking into account invalid words.

oddMap :: Bimap Word8 OddWord Source

Mapping from and to OddWords