Last active
December 11, 2015 19:41
-
-
Save cognominal/3aed2e52f2cecce1d653 to your computer and use it in GitHub Desktop.
sha1 hash
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
subset Sha1 of Str where *.chars == 40 and m:i/<[A..F 0..9]>/; | |
class Sha1H does Associative { | |
has %!h; | |
method AT-KEY(Sha1 $_) { %!h{ .lc } }; | |
method ASSIGN-KEY(Sha1 $_, $v) { %!h{ .lc } = $v } | |
} | |
my %h is Sha1H; | |
my $sha1 = '64B0F6C3681E428CCE2EB830B05F27B3D7ED643E'; | |
say $sha1.chars; | |
%h{$sha1} = 'a'; | |
say %h{$sha1}; | |
%h<a> = 'b'; # fail here because not Sha1 :) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment