packages feed

crypto-cipher-types 0.0.5 → 0.0.6

raw patch · 2 files changed

+26/−1 lines, 2 filesPVP: major bump suggested

API removals or changes: PVP suggests a major version bump

API changes (from Hackage documentation)

+ Crypto.Cipher.Types: cfbDecrypt :: BlockCipher cipher => cipher -> IV cipher -> ByteString -> ByteString
+ Crypto.Cipher.Types: cfbEncrypt :: BlockCipher cipher => cipher -> IV cipher -> ByteString -> ByteString
- Crypto.Cipher.Types: class Cipher cipher => BlockCipher cipher where cbcEncrypt = cbcEncryptGeneric cbcDecrypt = cbcDecryptGeneric ctrCombine = ctrCombineGeneric xtsEncrypt = xtsEncryptGeneric xtsDecrypt = xtsDecryptGeneric aeadInit _ _ _ = Nothing
+ Crypto.Cipher.Types: class Cipher cipher => BlockCipher cipher where cbcEncrypt = cbcEncryptGeneric cbcDecrypt = cbcDecryptGeneric cfbEncrypt = cfbEncryptGeneric cfbDecrypt = cfbDecryptGeneric ctrCombine = ctrCombineGeneric xtsEncrypt = xtsEncryptGeneric xtsDecrypt = xtsDecryptGeneric aeadInit _ _ _ = Nothing

Files

Crypto/Cipher/Types.hs view
@@ -107,6 +107,17 @@     cbcDecrypt :: cipher -> IV cipher -> ByteString -> ByteString     cbcDecrypt = cbcDecryptGeneric +    -- | encrypt using the CFB mode.+    --+    -- input need to be a multiple of the blocksize+    cfbEncrypt :: cipher -> IV cipher -> ByteString -> ByteString+    cfbEncrypt = cfbEncryptGeneric+    -- | decrypt using the CFB mode.+    --+    -- input need to be a multiple of the blocksize+    cfbDecrypt :: cipher -> IV cipher -> ByteString -> ByteString+    cfbDecrypt = cfbDecryptGeneric+     -- | combine using the CTR mode.     --     -- CTR mode produce a stream of randomized data that is combined@@ -280,6 +291,20 @@   where doDec _  []     = []         doDec iv (i:is) =             let o = bxor iv $ ecbDecrypt cipher i+             in o : doDec i is++cfbEncryptGeneric :: BlockCipher cipher => cipher -> IV cipher -> ByteString -> ByteString+cfbEncryptGeneric cipher (IV ivini) input = B.concat $ doEnc ivini $ chunk (blockSize cipher) input+  where doEnc _  []     = []+        doEnc iv (i:is) =+            let o = bxor i $ ecbEncrypt cipher iv+             in o : doEnc o is++cfbDecryptGeneric :: BlockCipher cipher => cipher -> IV cipher -> ByteString -> ByteString+cfbDecryptGeneric cipher (IV ivini) input = B.concat $ doDec ivini $ chunk (blockSize cipher) input+  where doDec _  []     = []+        doDec iv (i:is) =+            let o = bxor i $ ecbEncrypt cipher iv              in o : doDec i is  ctrCombineGeneric :: BlockCipher cipher => cipher -> IV cipher -> ByteString -> ByteString
crypto-cipher-types.cabal view
@@ -1,5 +1,5 @@ Name:                crypto-cipher-types-Version:             0.0.5+Version:             0.0.6 Synopsis:            Generic cryptography cipher types Description:         Generic cryptography cipher types License:             BSD3