packages feed

bindings-nettle 0.3 → 0.3.1

raw patch · 3 files changed

+7/−7 lines, 3 files

Files

Bindings/Nettle/Cipher/CAST128.hsc view
@@ -7,14 +7,14 @@ #strict_import  #num CAST128_BLOCK_SIZE-#num CAST128_MIN_KEY_SIZE-#num CAST128_MAX_KEY_SIZE+#num CAST5_MIN_KEY_SIZE+#num CAST5_MAX_KEY_SIZE #num CAST128_KEY_SIZE  #starttype struct cast128_ctx #stoptype -#ccall cast128_set_key , Ptr <struct cast128_ctx> -> CUInt -> Ptr CUChar -> IO ()+#ccall cast5_set_key , Ptr <struct cast128_ctx> -> CUInt -> Ptr CUChar -> IO ()+#ccall cast128_set_key , Ptr <struct cast128_ctx> -> Ptr CUChar -> IO () #ccall cast128_encrypt , Ptr <struct cast128_ctx> -> CUInt -> Ptr CUChar -> Ptr CUChar -> IO () #ccall cast128_decrypt , Ptr <struct cast128_ctx> -> CUInt -> Ptr CUChar -> Ptr CUChar -> IO ()-
bindings-nettle.cabal view
@@ -1,5 +1,5 @@ name:                bindings-nettle-version:             0.3+version:             0.3.1 synopsis:            bindings to nettle crypto library description:         partial bindings to nettle crypto library homepage:            http://floss.scru.org/bindings-nettle
test/suite.hs view
@@ -32,14 +32,14 @@  cast5_decrypt :: B.ByteString -> B.ByteString -> IO B.ByteString cast5_decrypt key payload = alloca $ \ctx -> allocaBytes (B.length payload) $ \buf -> withArray (map fromIntegral . B.unpack $ key) $ \k -> withArray (map fromIntegral . B.unpack $ payload) $ \src -> do-    _ <- c'nettle_cast128_set_key ctx (fromIntegral . B.length $ key) k+    _ <- c'nettle_cast5_set_key ctx (fromIntegral . B.length $ key) k     _ <- c'nettle_cast128_decrypt ctx (fromIntegral . B.length $ payload) buf src     res <- peekArray (B.length payload) buf     return $ B.pack $ map fromIntegral res  cast5_encrypt :: B.ByteString -> B.ByteString -> IO B.ByteString cast5_encrypt key payload = alloca $ \ctx -> allocaBytes (B.length payload) $ \buf -> withArray (map fromIntegral . B.unpack $ key) $ \k -> withArray (map fromIntegral . B.unpack $ payload) $ \src -> do-    _ <- c'nettle_cast128_set_key ctx (fromIntegral . B.length $ key) k+    _ <- c'nettle_cast5_set_key ctx (fromIntegral . B.length $ key) k     _ <- c'nettle_cast128_encrypt ctx (fromIntegral . B.length $ payload) buf src     res <- peekArray (B.length payload) buf     return $ B.pack $ map fromIntegral res