Blake implementation in ELisp.
Currently only blake2s (256-bit) and blake2b (512-bit).
Clone and install manually, then:
(require 'blake)(blake-two blake-two-big "abc")
To get the same output as with b2sum, serialize the output:
;; echo -n abc | b2sum
(string-join (mapcar (lambda (x) (format "%02x" x))
(blake-two blake-two-big "abc"))
"")Note that the implementation is obviously slower than with compiled languages
and, for example, running an elisp-manual-21-2.8.tar.gz (2455995 bytes) with
blake-two-big took astonishing 75s! (40s once byte-compiled) while with
coreutils' b2sum it took under one second.
(with-temp-buffer
(set-buffer-multibyte nil)
(insert-file-contents-literally "elisp-manual-21-2.8.tar.gz")
(message "hash: %s"
(string-join (mapcar (lambda (x) (format "%02x" x))
(blake-two blake-two-big (buffer-string)))
"")))While there might be performance bottlenecks in the current implementation, if you are looking for speed, there are better and safer implementations.