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

take better advantage of precompilation

stevengj opened this issue · comments

Currently, there are a lot of things happening in the __init__ statement, which makes precompilation not help much for Nettle. I think this can probably be fixed.

e.g. consider hash_init. Instead of defining a new type <: HashAlgorithm for each hash Nettle defines (detected at runtime), why not just work with NettleHash directly, with a constructor like NettleHash(name::AbstractString) to look up the structure at runtime for a given name, and a function nettlehashes() to return the available names?

In most applications, like IJulia, we only want a particular hash, and we know which one we want in advance — if Nettle is missing this one, we just want to throw an error. So, there is no point in setting up all the hashes when the module is loaded.

Closed by ed4d932, although a better selection of functions in precompile.jl wouldn't go amiss.