packages feed

cryptonite 0.18 → 0.19

raw patch · 4 files changed

+44/−4 lines, 4 filesPVP ok

version bump matches the API change (PVP)

API changes (from Hackage documentation)

Files

CHANGELOG.md view
@@ -1,3 +1,8 @@+## 0.19++* Add tutorial (Yann Esposito)+* Derive Show instance for better interaction with Show pretty printer (Eric Mertens)+ ## 0.18  * Re-used standard rdrand instructions instead of bytedump of rdrand instruction
Crypto/Error/Types.hs view
@@ -52,10 +52,8 @@ data CryptoFailable a =       CryptoPassed a     | CryptoFailed CryptoError+    deriving (Show) -instance Show a => Show (CryptoFailable a) where-    show (CryptoPassed a)   = "CryptoPassed " ++ show a-    show (CryptoFailed err) = "CryptoFailed " ++ show err instance Eq a => Eq (CryptoFailable a) where     (==) (CryptoPassed a)  (CryptoPassed b)  = a == b     (==) (CryptoFailed e1) (CryptoFailed e2) = e1 == e2
+ Crypto/Tutorial.hs view
@@ -0,0 +1,34 @@+{-# OPTIONS_GHC -fno-warn-unused-imports #-}+{-# LANGUAGE OverloadedStrings #-}++{-| How to use @cryptonite@++> -- | Beware MUST BE 256bits as we use AES256+> import Data.ByteString (ByteString)+> import Crypto.Cipher.AES (AES256)+> import Crypto.Cipher.Types (BlockCipher(..), Cipher(..),nullIV)+> import Crypto.Error (CryptoFailable(..))+>+> secretKey :: ByteString+> secretKey = "012-456-89A-CDE-012-456-89A-CDE-"+>+> encrypt :: ByteString -> ByteString -> ByteString+> encrypt secret = ctrCombine ctx nullIV+>   where+>     ctx = cipherInitNoErr (cipherMakeKey (undefined :: AES256) secret)+>     cipherInitNoErr :: BlockCipher c => Key c -> c+>     cipherInitNoErr (Key k) = case cipherInit k of+>       CryptoPassed a -> a+>       CryptoFailed e -> error (show e)+>     cipherMakeKey :: Cipher cipher => cipher -> ByteString -> Key cipher+>     cipherMakeKey _ = Key -- Yeah Lazyness!!!!!!+>+>+> decrypt :: ByteString -> ByteString -> ByteString+> decrypt = encrypt++|-}++module Crypto.Tutorial () where++import Crypto.Cipher.Types
cryptonite.cabal view
@@ -1,5 +1,5 @@ Name:                cryptonite-Version:             0.18+Version:             0.19 Synopsis:            Cryptography Primitives sink Description:     A repository of cryptographic primitives.@@ -23,6 +23,8 @@     cryptographic kitchen sink that provides cryptography for everyone.     .     Evaluate the security related to your requirements before using.+    .+    Read "Crypto.Tutorial" for a quick start guide. License:             BSD3 License-file:        LICENSE Copyright:           Vincent Hanquez <vincent@snarc.org>@@ -139,6 +141,7 @@                      Crypto.Random.Entropy                      Crypto.Random.EntropyPool                      Crypto.Random.Entropy.Unsafe+                     Crypto.Tutorial   Other-modules:     Crypto.Cipher.AES.Primitive                      Crypto.Cipher.Blowfish.Box                      Crypto.Cipher.Blowfish.Primitive