In Python, there is a function called digest from hashlib module, which returns the digest of a byte string:
import hashlib
id = "65766"
song_id = bytearray(id, "u8")
m = hashlib.md5(song_id)
result = m.digest()
print(result)
# Output
# b"\xc9j\xa4/vy}+'\xe6\x8e\xe4\xcc\xd8\xa8\xc8"
I find a module from raku.land named Digest::MD5, but it doesn't provide the digest sub:
my $d = Digest::MD5.new;
my $id = "65766";
my Buf $md5-buf = $d.md5_buf($id);
# ???
And I don't want to introduce Inline::Python or Inline::Perl5 into my project, Is it possible to implement digest sub in Raku?