Anonymous user
Substitution cipher: Difference between revisions
m
→{{header|Haskell}}
(added Haskell) |
|||
Line 877:
cipherMap :: [(Char, Char)]
cipherMap = zip alphabet (
shuffle :: Int -> String -> String
shuffle 0 xs = xs
shuffle n xs = iterate go xs !! n
where go [] = []
go xs = go (drop 2 xs) <> take 2 xs
convert :: [(Char, Char)] -> String -> String
Line 900 ⟶ 906:
main = parseArgs <$> getArgs >>= putStrLn . runCommand</lang>
{{out}}
<pre>$ simplecipher c "The quick brown fox jumped over the lazy dogs
@Ty3xt}w~3N^zrZ3Rzd3Vt|\yP3zby^3`Ty3Xufp3Pz{v%
$ simplecipher d '@Ty3xt}w~3N^zrZ3Rzd3Vt|\yP3zby^3`Ty3Xufp3Pz{v%'
▲The quick brown fox jumped over the lazy dogs!</pre>
=={{header|J}}==
|