Created
January 11, 2014 23:38
-
-
Save johl/8378452 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{-# LANGUAGE OverloadedStrings #-} | |
import Data.ByteString.Char8 () | |
import qualified Data.ByteString as B | |
import Data.ByteString.Base64 (decode) | |
import Data.Bits (xor) | |
Right key = decode "kTSFoLQRrR+hWJlLjAwXqOH5Z3ZLDWray5mBgNK7lLuHdTwab8m/v96y" | |
encrypt = B.pack . B.zipWith xor key | |
decrypt = encrypt | |
main = do | |
let encrypted = encrypt "I'm a secret message" | |
print encrypted | |
print $ decrypt encrypted |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment