Skip to content

Instantly share code, notes, and snippets.

@johl
Created January 11, 2014 23:38
Show Gist options
  • Save johl/8378452 to your computer and use it in GitHub Desktop.
Save johl/8378452 to your computer and use it in GitHub Desktop.
{-# 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