[Haskell-cafe] haskell cryptogaphic libraries

marcmo oliver.mueller at gmail.com
Fri Aug 24 17:22:30 CEST 2012


indeed a very simple solution for AES!

On Friday, August 24, 2012 3:00:06 PM UTC+2, Nils Schweinsberg wrote:
>
> Am 24.08.2012 14:47, schrieb marcmo: 
> > * AES Encryption/Decryption (CBC-Mode) 
>
> For AES there is the "SimpleAES" package[1] which is super easy to use: 
>
> > import qualified Data.ByteString      as BS 
> > import           Data.ByteString.Lazy as BL 
> > 
> > import Codec.Crypto.SimpleAES 
> > 
> > key :: IO Key 
> > key = BS.readFile "key" 
> > 
> > encrypt :: ByteString -> IO ByteString 
> > encrypt bs = do 
> >   k <- key 
> >   encryptMsg CBC k bs 
> > 
> > decrypt :: ByteString -> IO ByteString 
> > decrypt bs = do 
> >   k <- key 
> >   return $ decryptMsg CBC k bs 
>
> (note that the key is a strict ByteString while the encrypted/decrypted 
> data is lazy) 
>
> [1]: http://hackage.haskell.org/package/SimpleAES 
>
> _______________________________________________ 
> Haskell-Cafe mailing list 
> Haskel... at haskell.org <javascript:> 
> http://www.haskell.org/mailman/listinfo/haskell-cafe 
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/haskell-cafe/attachments/20120824/4dd2245c/attachment.htm>


More information about the Haskell-Cafe mailing list