sha256

Pure Haskell SHA-256, HMAC-SHA256 as specified by RFC's 6234 and 2104.
git clone git://git.ppad.tech/sha256.git
Log | Files | Refs | README | LICENSE

commit 3a01d856756cdb7efb446043fdfab84bea1b1367
parent 04aee7f3f5781614832f33c29b4c34a55b2bbb36
Author: Jared Tobin <jared@jtobin.io>
Date:   Sat, 14 Sep 2024 00:36:27 +0400

lib: remove hashlarge example

Diffstat:
Mppad-sha256.cabal | 12------------
Dsrc/HashLarge.hs | 38--------------------------------------
2 files changed, 0 insertions(+), 50 deletions(-)

diff --git a/ppad-sha256.cabal b/ppad-sha256.cabal @@ -62,15 +62,3 @@ benchmark sha256-bench , ppad-sha256 , SHA -executable hash-large - main-is: HashLarge.hs - ghc-options: -rtsopts -Wall -O2 - default-language: Haskell2010 - hs-source-dirs: src - build-depends: - base - , base16-bytestring - , bytestring - , ppad-sha256 - , SHA - diff --git a/src/HashLarge.hs b/src/HashLarge.hs @@ -1,38 +0,0 @@ -{-# LANGUAGE OverloadedStrings #-} - -module Main where - -import qualified Crypto.Hash.SHA256 as SHA256 -import qualified Data.ByteString.Lazy as BL -import qualified Data.ByteString.Builder as BSB -import qualified Data.ByteString.Base16 as B16 -import qualified Data.Digest.Pure.SHA as SHA -import System.Environment - -main :: IO () -main = do - args <- getArgs - case args of - mode:[] -> - if mode == "make" - then make - else hash - _ -> error "incorrect args" - -hash :: IO () -hash = do - input <- BL.readFile "ppad-sha256-hash-large.dat" - let digest = SHA.sha256 input -- B16.encode $ SHA256.hash_lazy input - print digest - -make :: IO () -make = BL.writeFile "ppad-sha256-hash-large.dat" big_input where - big_input :: BL.ByteString - big_input = go (16777216 :: Int) mempty where - go j acc - | j == 0 = BSB.toLazyByteString acc - | otherwise = - let nacc = acc <> BSB.lazyByteString - "abcdefghbcdefghicdefghijdefghijkefghijklfghijklmghijklmnhijklmno" - in go (pred j) nacc -