Substitution cipher: Difference between revisions

m
(added Haskell)
Line 877:
 
cipherMap :: [(Char, Char)]
cipherMap = zip alphabet (reverseshuffle 20 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%
J69~-)5;3~<,/'0~8/&~4)1.9:~/(9,~*69~2=$%~:/7+}
 
$ simplecipher d '@Ty3xt}w~3N^zrZ3Rzd3Vt|\yP3zby^3`Ty3Xufp3Pz{v%'
The quick brown fox jumped over the lazy dogs!.</pre>
 
$ simplecipher d "J69~-)5;3~<,/'0~8/&~4)1.9:~/(9,~*69~2=$%~:/7+}"
The quick brown fox jumped over the lazy dogs!</pre>
=={{header|J}}==
 
Anonymous user