Skip to content
Browse files

reindentation, misc cleanup to be compliant with other implementations,

misc.
  • Loading branch information...
1 parent 9a5712d commit dd8973694bbef687e6aad72981378e3bafd147d3 @vincenthz committed Oct 29, 2012
Showing with 883 additions and 881 deletions.
  1. +3 −3 Crypto/Hash/Whirlpool.hs
  2. +874 −869 cbits/whirlpool.c
  3. +6 −9 cbits/whirlpool.h
View
6 Crypto/Hash/Whirlpool.hs
@@ -76,8 +76,8 @@ instance Storable Ctx where
foreign import ccall unsafe "whirlpool.h whirlpool_init"
c_whirlpool_init :: Ptr Ctx -> IO ()
-foreign import ccall "whirlpool.h whirlpool_add"
- c_whirlpool_update :: CString -> Word32 -> Ptr Ctx -> IO ()
+foreign import ccall "whirlpool.h whirlpool_update"
+ c_whirlpool_update :: Ptr Ctx -> CString -> Word32 -> IO ()
foreign import ccall unsafe "whirlpool.h whirlpool_finalize"
c_whirlpool_finalize :: Ptr Ctx -> CString -> IO ()
@@ -90,7 +90,7 @@ allocInternalFrom ctx f = allocInternal $ \ptr -> (poke ptr ctx >> f ptr)
updateInternalIO :: Ptr Ctx -> ByteString -> IO ()
updateInternalIO ptr d =
- unsafeUseAsCStringLen d (\(cs, len) -> c_whirlpool_update cs (8 * fromIntegral len) ptr)
+ unsafeUseAsCStringLen d (\(cs, len) -> c_whirlpool_update ptr cs (fromIntegral len))
finalizeInternalIO :: Ptr Ctx -> IO ByteString
finalizeInternalIO ptr =
View
1,743 cbits/whirlpool.c
874 additions, 869 deletions not shown because the diff is too large. Please use a local Git client to view these changes.
View
15 cbits/whirlpool.h
@@ -18,17 +18,14 @@
typedef struct whirlpool_ctx {
uint8_t bitLength[LENGTHBYTES]; /* global number of hashed bits (256-bit counter) */
- uint8_t buffer[WBLOCKBYTES]; /* buffer of data to hash */
- uint32_t bufferBits; /* current number of bits on the buffer */
- uint32_t bufferPos; /* current (possibly incomplete) byte slot on the buffer */
+ uint8_t buffer[WBLOCKBYTES]; /* buffer of data to hash */
+ uint32_t bufferBits; /* current number of bits on the buffer */
+ uint32_t bufferPos; /* current (possibly incomplete) byte slot on the buffer */
uint64_t hash[DIGESTBYTES/8]; /* the hashing state */
} whirlpool_ctx;
-void whirlpool_init(struct whirlpool_ctx * const structpointer);
-void whirlpool_add(const unsigned char * const source,
- unsigned long sourceBits,
- struct whirlpool_ctx * const structpointer);
-void whirlpool_finalize(struct whirlpool_ctx * const structpointer,
- unsigned char * const result);
+void whirlpool_init(struct whirlpool_ctx * const ctx);
+void whirlpool_update(struct whirlpool_ctx * const ctx, const uint8_t * const source, uint32_t len);
+void whirlpool_finalize(struct whirlpool_ctx * const ctx, uint8_t * const result);
#endif

0 comments on commit dd89736

Please sign in to comment.
Something went wrong with that request. Please try again.