JuliaCrypto / Nettle.jl

Julia wrapper around nettle cryptographic hashing/encryption library providing MD5, SHA1, SHA2 hashing and HMAC functionality, as well as AES encryption/decryption

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Make a type for every hash function

JanisErdmanis opened this issue · comments

Currently, it is not possible to write a hash function generic security protocols. To understand that, consider data and hash value. Let's say we want to test that the hash value corresponds to the data:

ishash(data,hash)

The problem is that one can not make that generic.

A resolution for such a problem is to give type information for the hashes. Thus one could write a generic function:

ishash(data,hash::Hash) = typeof(hash)(data).hash==hash.hash

I started to implement an interface in my Signatures.jl package (lines 40 to 63), but that does not have a place there. @staticfloat could that be implemented in Nettle.jl?