Skip to content
This repository has been archived by the owner on Sep 20, 2023. It is now read-only.

Blake2: add modern interface using Nat #140

Merged
merged 5 commits into from Mar 18, 2017

Conversation

NicolasDP
Copy link
Contributor

Just continuing the improvements started with Cryptonite.Hash.SHAKE.

@ocheron
Copy link
Contributor

ocheron commented Mar 13, 2017

BLAKE2 is defined with a maximum digest size.
Is it possible to add this contraint using the operators from GHC.TypeLits ?

@NicolasDP
Copy link
Contributor Author

That's a good idea. I will see if I can come with something in Crypto.Internal.Nat.

@NicolasDP
Copy link
Contributor Author

Now, with base >= 4.9.0, we can have the nice following output:

/Users/nicolas/work/primetype/haskell-crypto/cryptonite/tests/Hash.hs:202:23: error:
    • bitlen 1024 is greater than 512
      You have tried to use an invalid Digest size. Please, refer to the documentation.
    • In the expression: HashAlg (Blake2b :: Blake2b 1024)
      In the expression:
        ("Blake2b 512", HashAlg (Blake2b :: Blake2b 1024), 
      ...

Also added the minimal constraint of 1 byte.

@vincenthz vincenthz merged commit 666eb4e into haskell-crypto:master Mar 18, 2017
@vincenthz
Copy link
Member

Nice, thanks !

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants