Safe Haskell | None |
---|---|
Language | Haskell98 |
Various ciphers.
- data Cipher key
- encode :: Cipher t -> t -> String -> String
- decode :: Cipher t -> t -> String -> String
- playfair :: Cipher [Char]
- substitution :: Cipher [(Char, Char)]
- addLetters :: Char -> Char -> Char
- subtractLetters :: Char -> Char -> Char
- viginere :: Cipher [Char]
- caesar :: Cipher Char
- newtype Plugboard = Plugboard [(Char, Char)]
- newtype Reflector = Reflector [(Char, Char)]
- newtype RotorMapping = RotorMapping [(Char, Char)]
- enigma :: RandomGen g => g -> Cipher (Plugboard, Reflector, (RotorMapping, RotorMapping, RotorMapping))
Documentation
substitution :: Cipher [(Char, Char)] Source
The letter substitution cipher
addLetters :: Char -> Char -> Char Source
subtractLetters :: Char -> Char -> Char Source
viginere :: Cipher [Char] Source
The Viginere cipher (acts like one-time pad if the key is as long as the plaintext)
newtype RotorMapping Source
RotorMapping [(Char, Char)] |
enigma :: RandomGen g => g -> Cipher (Plugboard, Reflector, (RotorMapping, RotorMapping, RotorMapping)) Source