Rand Stats

Digest

zef:grondilu

SparrowCI

Digests in raku

This is a raku repository implementing some digest algorithms.

By default the module uses a pure raku implementation, which is slow. An OpenSSL nativecall wrapper is used when the DIGEST_METHOD environment variable is set to "openssl". This wrapper requires OpenSSL version 3 or above.

Synopsis

Nb. Since commit 911c292688ad056a98285f7930297c5e1aea3bfb, there is no Digest module anymore, the submodules, Digest::MD5, Digest::SHA1 and so on must be used directly.

use Digest::MD5;
say md5      "hello";
use Digest::HMAC;
say hmac
  key => "key",
  msg => "The quick brown fox jumps over the lazy dog", 
  hash => &md5,
  block-size => 64;

use Digest::SHA1;
say sha1     "Hola";

use Digest::SHA2;
say sha256   "Привет"; 

use Digest::RIPEMD;
say rmd160   "Saluton";

use Digest::SHA3;
say sha3_256 "Bonjour";
say shake256 "Merhaba", 16;

# This will keep printing blocks
.say for shake256 "नमस्ते", *;

Features

Currently implemented:

License

This work is published under the terms of the artistic license, as rakudo is. See LICENSE file.