Skip to content

KeyWeeUsr/blake

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

47 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

blake

CI Coverage Status Buy me a coffee Liberapay PayPal

Blake implementation in ELisp.

Currently only blake2s (256-bit) and blake2b (512-bit).

How to

Clone and install manually, then:

  1. (require 'blake)
  2. (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.