<commit_before>{-# OPTIONS_GHC -fno-warn-orphans #-}
{-# LANGUAGE OverloadedStrings    #-}
{-# LANGUAGE ScopedTypeVariables  #-}
{-# LANGUAGE DataKinds            #-}
{-# LANGUAGE CPP                  #-}

module Raaz.Mac.Poly1305Spec where

import           Common
import           Common.Utils
import qualified Common.Cipher as C

import Raaz.Primitive.Poly1305.Internal


macsTo :: ByteString -> Poly1305 -> Key Poly1305 -> Spec
macsTo inp expected key =  it msg $ result `shouldBe` expected
  where result = mac key inp
        msg  = unwords [ "macs"
                       , shortened $ show inp
                       , "to"
                       , shortened $ show expected
                       ]
spec :: Spec
spec = do 
  describe "Poly1305" $ 
    basicEndianSpecs (undefined :: Poly1305)
  describe "R" $
    basicEndianSpecs (undefined :: R)
  describe "S" $
    basicEndianSpecs (undefined :: S)

    
  with ( "fd00:c2b6:b24b:be67:2827:688d:e6a1:6a3b:7f:44:52:fe:42:d5:06:a8"
       , "01:03:80:8a:fb:0d:b2:fd:4a:bf:f6:af:41:49:f5:1b"
       ) $ ( "Cryptographic Forum Research Group" :: ByteString)
    `macsTo` ("a8:06:1d:c1:30:51:36:c6:c2:2b:8b:af:0c:01:27:a9" :: Poly1305)
<commit_msg>print the key for poly1305 unit tests.<commit_after>{-# OPTIONS_GHC -fno-warn-orphans #-}
{-# LANGUAGE OverloadedStrings    #-}
{-# LANGUAGE ScopedTypeVariables  #-}
{-# LANGUAGE DataKinds            #-}
{-# LANGUAGE CPP                  #-}

module Raaz.Mac.Poly1305Spec where

import           Common
import           Common.Utils
import qualified Common.Cipher as C

import Raaz.Primitive.Poly1305.Internal


macsTo :: ByteString -> Poly1305 -> Key Poly1305 -> Spec
macsTo inp expected key =  it msg $ result `shouldBe` expected
  where result = mac key inp
        msg  = unwords [ "with key"
                       , shortened $ show key
                       , "macs"
                       , shortened $ show inp
                       , "to"
                       , shortened $ show expected
                       ]
spec :: Spec
spec = do 
  describe "Poly1305" $ 
    basicEndianSpecs (undefined :: Poly1305)
  describe "R" $
    basicEndianSpecs (undefined :: R)
  describe "S" $
    basicEndianSpecs (undefined :: S)

    
  with ( "85:d6:be:78:57:55:6d:33:7f:44:52:fe:42:d5:06:a8"
       , "01:03:80:8a:fb:0d:b2:fd:4a:bf:f6:af:41:49:f5:1b"
       ) $ ( "Cryptographic Forum Research Group" :: ByteString)
    `macsTo` ("fd00:c2b6:b24b:be67:2827:688d:e6a1:6a3b:c2:2b:8b:af:0c:01:27:a9" :: Poly1305)

{'fraction_non_alphanumeric': 0.12862246923382295, 'fraction_numerical': 0.0778086542278682, 'mean_word_length': 2.272727272727273, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 9, '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': '1185719', 'n_tokens_mistral': 1027, 'n_tokens_neox': 924, 'n_words': 181}