Skip to content
Create a gist now

Instantly share code, notes, and snippets.

$ cat bug
sub digest(Str $text) is export {
my $binary = Q:PIR {
.local string text
.local pmc digest
# Input
$P0 = find_lex '$text'
text = $P0
# Choose the right digest.
$P1 = loadlib 'digest_group'
digest = new 'SHA256'
# Calculate the digest.
$S0 = digest.'Final'()
%r = box $S0
# Convert to hex.
return [~] map { sprintf '%02x', .ord }, $binary.comb;
say digest('user_name=carl'.split("=")[1]);
say digest('carl');
$ perl6 bug
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.