sha256

A pure Haskell implementation of SHA-256 as specified by RFC 6234.
git clone git://git.ppad.tech/sha256.git
Log | Files | Refs | LICENSE

commit c1f0e8742be5fb724c37694508f088de9dc8274b
parent d4da6477f90cc70fada0b4fb89fab70b0365826f
Author: Jared Tobin <jared@jtobin.io>
Date:   Tue, 10 Sep 2024 09:19:39 +0400

lib: s/chunks/blocks

Diffstat:
Mlib/Crypto/Hash/SHA256.hs | 8++++----
1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/lib/Crypto/Hash/SHA256.hs b/lib/Crypto/Hash/SHA256.hs @@ -22,9 +22,9 @@ import Data.Word (Word32, Word64) fi :: (Integral a, Num b) => a -> b fi = fromIntegral --- break a bytestring into chunks of the specified bytelength -chunks :: Int -> BS.ByteString -> [BS.ByteString] -chunks s = loop where +-- break a bytestring into blocks of the specified bytelength +blocks :: Int -> BS.ByteString -> [BS.ByteString] +blocks s = loop where loop bs | BS.null bs = [] | otherwise = case BS.splitAt s bs of @@ -288,7 +288,7 @@ hash :: BS.ByteString -> BS.ByteString hash = cat . L.foldl' alg iv - . chunks 64 + . blocks 64 . pad where alg acc = block_hash acc . prepare_schedule . parse