Twofish 0.3.1 → 0.3.2
raw patch · 2 files changed
+4/−4 lines, 2 files
Files
- Data/Bitlib.hs +3/−3
- Twofish.cabal +1/−1
Data/Bitlib.hs view
@@ -7,14 +7,14 @@ import Data.Bits -pack :: (Integral a, Bits a, Bits b) => [a] -> b+pack :: (Integral a, Bits a, Integral b, Bits b) => [a] -> b pack [] = fromInteger 0 pack (x:[]) = fromIntegral x pack (x:xs) = (fromIntegral x) .|. ((pack xs) `shiftL` (bitSize x)) unpack :: (Integral a, Bits a, Num b, Bits b) => a -> [b] unpack = doUnpack 0- where doUnpack :: (Integral a, Bits a, Bits b) => Int -> a -> [b]+ where doUnpack :: (Integral a, Bits a, Num b, Bits b) => Int -> a -> [b] doUnpack n x | n == bitSize x = [] | otherwise = (fromIntegral (x .&. 0xFF)) : doUnpack (n + 8) (x `shiftR` 8)@@ -25,6 +25,6 @@ let ct = (bitSize zero) `div` (bitSize x) in pack (take ct xs) : packMany zero (drop ct xs) -unpackMany :: (Integral a, Bits a, Bits b) => [a] -> [b]+unpackMany :: (Integral a, Bits a, Num b, Bits b) => [a] -> [b] unpackMany [] = [] unpackMany (x:xs) = concat [(unpack x), (unpackMany xs)]
Twofish.cabal view
@@ -1,5 +1,5 @@ Name: Twofish-Version: 0.3.1+Version: 0.3.2 Category: Cryptography, Codec Synopsis: An implementation of the Twofish Symmetric-key cipher. Description: Implements the Twofish symmetric block cipher, designed by: