SHA-256: Difference between revisions

m
→‎{{header|Perl 6}}: renaming function
(accepting the use of library)
m (→‎{{header|Perl 6}}: renaming function)
Line 5:
 
=={{header|Perl 6}}==
<lang Perl 6>say .list».fmt("%02x").join given sha256SHA-256 "Rosetta code";
 
constant K = init * **(1/3), 64;
Line 16:
sub rotr($n, $b) { $n +> $b +| $n +< (32 - $b) }
 
proto sha256SHA-256($) returns Buf {*}
multi sha256SHA-256(Str $s) { sha256 Buf.new: $s.ords }
multi sha256SHA-256(Buf $data) {
my $l = 8 * my @b = $data.list;
push @b, 0x80; push @b, 0 until (8*@b-448) %% 512;
1,934

edits