Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
Core functionality for conversion between binary formats and PGP word lists.
- newtype PgpWordlist = PgpWordlist (AltList EvenWord OddWord)
- data TranslationError
- toText :: ByteString -> Text
- fromText :: Text -> Either TranslationError ByteString
- newtype EvenWord = EvenWord {
- unEvenWord :: Text
- toEvenWord :: Word8 -> EvenWord
- fromEvenWord :: Text -> Either TranslationError Word8
- evenMap :: Bimap Word8 EvenWord
- newtype OddWord = OddWord {}
- toOddWord :: Word8 -> OddWord
- fromOddWord :: Text -> Either TranslationError Word8
- oddMap :: Bimap Word8 OddWord
- wordList :: [(Word8, EvenWord, OddWord)]
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.
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
.
Word that is supposed to occur in an even position
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.
Word that is supposed to occur in an odd position
fromOddWord :: Text -> Either TranslationError Word8 Source
Simple conversion, taking into account invalid words.