spacemonkeygo / openssl

OpenSSL bindings for Go
http://godoc.org/github.com/spacemonkeygo/openssl
Apache License 2.0
473 stars 236 forks source link

Support for all available hash functions to compute message digests #129

Open vitalyisaev2 opened 4 years ago

vitalyisaev2 commented 4 years ago

Please consider this PR that provides an opportunity to utilize any hash function impemented in OpenSSL:

$ openssl list --digest-commands
blake2b512        blake2s256        gost              md2               
md4               md5               rmd160            sha1              
sha224            sha256            sha3-224          sha3-256          
sha3-384          sha3-512          sha384            sha512            
sha512-224        sha512-256        shake128          shake256          
sm3 

New generic entity DigestComputer is introduced. Existing types like SHA256Hash or MD5Hash now embed this structure to preserve backward compatibility, but prevent code duplication. All the other digests (like BLAKE2 etc.) can be calculated with the direct use of DigestComputer