<commit_before>{-|

This module gives the reference implementation of the Blake256
hash. Depending on your platform there might be a more efficient
implementation. So you /should not/ be using this code in production.

-}

{-# LANGUAGE BangPatterns, OverloadedStrings #-}

module Raaz.Hash.Blake256.Ref
       ( blake256CompressSingle
       ) where

import Control.Applicative
import Data.Bits
import Data.ByteString         (ByteString)
import Data.ByteString.Char8   ()
import Data.ByteString.Unsafe  (unsafeIndex)
import Data.Word
import qualified Data.Vector.Unboxed as VU
import Numeric                 ()

import Raaz.Core.Types
import Raaz.Core.Util.Ptr

import Raaz.Hash.Blake256.Type

-- | This gives the 10 permutation of {0,...,15} used by Blake functions.
table :: ByteString
table = "\x0\x1\x2\x3\x4\x5\x6\x7\x8\x9\xa\xb\xc\xd\xe\xf\
        \\xe\xa\x4\x8\x9\xf\xd\x6\x1\xc\x0\x2\xb\x7\x5\x3\
        \\xb\x8\xc\x0\x5\x2\xf\xd\xa\xe\x3\x6\x7\x1\x9\x4\
        \\x7\x9\x3\x1\xd\xc\xb\xe\x2\x6\x5\xa\x4\x0\xf\x8\
        \\x9\x0\x5\x7\x2\x4\xa\xf\xe\x1\xb\xc\x6\x8\x3\xd\
        \\x2\xc\x6\xa\x0\xb\x8\x3\x4\xd\x7\x5\xf\xe\x1\x9\
        \\xc\x5\x1\xf\xe\xd\x4\xa\x0\x7\x6\x3\x9\x2\x8\xb\
        \\xd\xb\x7\xe\xc\x1\x3\x9\x5\x0\xf\x4\x8\x6\x2\xa\
        \\x6\xf\xe\x9\xb\x3\x0\x8\xc\x2\xd\x7\x1\x4\xa\x5\<commit_msg>ignore code duplication warning in hlint<commit_after>{-|

This module gives the reference implementation of the Blake256
hash. Depending on your platform there might be a more efficient
implementation. So you /should not/ be using this code in production.

-}

{-# LANGUAGE BangPatterns, OverloadedStrings #-}

module Raaz.Hash.Blake256.Ref
       ( blake256CompressSingle
       ) where

import Control.Applicative
import Data.Bits
import Data.ByteString         (ByteString)
import Data.ByteString.Char8   ()
import Data.ByteString.Unsafe  (unsafeIndex)
import Data.Word
import qualified Data.Vector.Unboxed as VU
import Numeric                 ()

import Raaz.Core.Types
import Raaz.Core.Util.Ptr

import Raaz.Hash.Blake256.Type

{-# ANN module ("HLint: ignore Reduce duplication" :: String) #-}

-- | This gives the 10 permutation of {0,...,15} used by Blake functions.
table :: ByteString
table = "\x0\x1\x2\x3\x4\x5\x6\x7\x8\x9\xa\xb\xc\xd\xe\xf\
        \\xe\xa\x4\x8\x9\xf\xd\x6\x1\xc\x0\x2\xb\x7\x5\x3\
        \\xb\x8\xc\x0\x5\x2\xf\xd\xa\xe\x3\x6\x7\x1\x9\x4\
        \\x7\x9\x3\x1\xd\xc\xb\xe\x2\x6\x5\xa\x4\x0\xf\x8\
        \\x9\x0\x5\x7\x2\x4\xa\xf\xe\x1\xb\xc\x6\x8\x3\xd\
        \\x2\xc\x6\xa\x0\xb\x8\x3\x4\xd\x7\x5\xf\xe\x1\x9\
        \\xc\x5\x1\xf\xe\xd\x4\xa\x0\x7\x6\x3\x9\x2\x8\xb\
        \\xd\xb\x7\xe\xc\x1\x3\x9\x5\x0\xf\x4\x8\x6\x2\xa\
        \\x6\xf\xe\x9\xb\x3\x0\x8\xc\x2\xd\x7\x1\x4\xa\x5\
{'fraction_non_alphanumeric': 0.16944847605224964, 'fraction_numerical': 0.0783744557329463, 'mean_word_length': 2.293906810035842, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1971024', 'n_tokens_mistral': 1335, 'n_tokens_neox': 1296, 'n_words': 189}