SHA-256: Difference between revisions

(→‎{{header|Perl 6}}: not using a multi)
(→‎{{header|Perl 6}}: minor change)
Line 132:
<lang Perl 6>say .list».fmt("%02x").join given sha256 "Rosetta code".encode: "ascii";
 
constant K = init * **(1/3), 64;
sub init(&f, $n) {
map { (($_ - .Int)*2**32).Int },
Line 142 ⟶ 141:
 
sub sha256(Buf $data) returns Buf {
constant my \K = init * **(1/3), 64;
my $l = 8 * my @b = $data.list;
push @b, 0x80; push @b, 0 until (8*@b-448) %% 512;
1,934

edits