public
Last active

  • Download Gist
a minima; example of the bug
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
$ 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.
digest.'Init'()
digest.'Update'(text)
$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
04f8996da763b7a969b1028ee3007569eaf3a635486ddab211d512c85b9df8fb
69bfe1e6e44821df7f8a0927bd7e61ef208fdb25deaa4353450bc3fb904abd52

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.