Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Added links to the SHA-3 wiki pages.

  • Loading branch information...
commit 8056ed365c65e214596a97b672d77031603046a1 1 parent c70441d
Bartek digit4lfa1l authored
Showing with 15 additions and 14 deletions.
  1. +9 −8 lib/DDG/Goodie/CryptHashCheck.pm
  2. +6 −6 t/CryptHashCheck.t
17 lib/DDG/Goodie/CryptHashCheck.pm
View
@@ -8,6 +8,7 @@ use DDG::Goodie;
use constant MD5HERF => "http://en.wikipedia.org/wiki/MD5";
use constant SHA1HREF => "http://en.wikipedia.org/wiki/SHA-1";
use constant SHA2HREF => "http://en.wikipedia.org/wiki/SHA-2";
+use constant SHA3HREF => "http://en.wikipedia.org/wiki/SHA-3";
zci is_cached => 1;
@@ -45,32 +46,32 @@ handle remainder => sub {
my ($sha224) = /^[0-9a-f]{56}$/i;
if ($sha224){
- my $text = sprintf qq(This is a 224 bit SHA-2 cryptographic hash.);
- my $html = sprintf qq(This is a 224 bit <a href="%s">SHA-2</a> cryptographic hash.),SHA2HREF;
+ my $text = sprintf qq(This is a 224 bit SHA-2/SHA-3 cryptographic hash.);
+ my $html = sprintf qq(This is a 224 bit <a href="%s">SHA-2</a>/<a href="%s">SHA-3</a> cryptographic hash.),SHA2HREF,SHA3HREF;
return $text, html => $html;
}
my ($sha256) = /^[0-9a-f]{64}$/i;
if ($sha256){
- my $text = sprintf qq(This is a 256 bit SHA-2 cryptographic hash.);
- my $html = sprintf qq(This is a 256 bit <a href="%s">SHA-2</a> cryptographic hash.),SHA2HREF;
+ my $text = sprintf qq(This is a 256 bit SHA-2/SHA-3 cryptographic hash.);
+ my $html = sprintf qq(This is a 256 bit <a href="%s">SHA-2</a>/<a href="%s">SHA-3</a> cryptographic hash.),SHA2HREF,SHA3HREF;
return $text, html => $html;
}
my ($sha384) = /^[0-9a-f]{96}$/i;
if ($sha384){
- my $text = sprintf qq(This is a 384 bit SHA-2 cryptographic hash.);
- my $html = sprintf qq(This is a 384 bit <a href="%s">SHA-2</a> cryptographic hash.),SHA2HREF;
+ my $text = sprintf qq(This is a 384 bit SHA-2/SHA-3 cryptographic hash.);
+ my $html = sprintf qq(This is a 384 bit <a href="%s">SHA-2</a>/<a href="%s">SHA-3</a> cryptographic hash.),SHA2HREF,SHA3HREF;
return $text, html => $html;
}
my ($sha512) = /^[0-9a-f]{128}$/i;
if ($sha512){
- my $text = sprintf qq(This is a 512 bit SHA-2 cryptographic hash.);
- my $html = sprintf qq(This is a 512 bit <a href="%s">SHA-2</a> cryptographic hash.),SHA2HREF;
+ my $text = sprintf qq(This is a 512 bit SHA-2/SHA-3 cryptographic hash.);
+ my $html = sprintf qq(This is a 512 bit <a href="%s">SHA-2</a>/<a href="%s">SHA-3</a> cryptographic hash.),SHA2HREF,SHA3HREF;
return $text, html => $html;
}
12 t/CryptHashCheck.t
View
@@ -18,8 +18,8 @@ ddg_goodie_test(
answer_type => "crypthashcheck"
),
'hash ecaceaca62d6c47190ed6c6f94a298f28a46450fda0bd1ec8fc64bc4a7a8cd436791a35f3c4e339b7ae480c1b751f1c1' => test_zci(
- qq(This is a 384 bit SHA-2 cryptographic hash.),
- html => qq(This is a 384 bit <a href="http://en.wikipedia.org/wiki/SHA-2">SHA-2</a> cryptographic hash.),
+ qq(This is a 384 bit SHA-2/SHA-3 cryptographic hash.),
+ html => qq(This is a 384 bit <a href="http://en.wikipedia.org/wiki/SHA-2">SHA-2</a>/<a href="http://en.wikipedia.org/wiki/SHA-3">SHA-3</a> cryptographic hash.),
answer_type => "crypthashcheck"
),
'hash b1d7eb51d4372c505446abca04835a101275e498' => test_zci(
@@ -28,13 +28,13 @@ ddg_goodie_test(
answer_type => "crypthashcheck"
),
'hash 6286e0a5cbc030f7b2d105f594ae0afb9105c92175c6b07ff454734c23cd0bddfed77639fe59b68a70b8c78af27657f611cbe89c27f7a47b978fa9449808c19f' => test_zci(
- qq(This is a 512 bit SHA-2 cryptographic hash.),
- html => qq(This is a 512 bit <a href="http://en.wikipedia.org/wiki/SHA-2">SHA-2</a> cryptographic hash.),
+ qq(This is a 512 bit SHA-2/SHA-3 cryptographic hash.),
+ html => qq(This is a 512 bit <a href="http://en.wikipedia.org/wiki/SHA-2">SHA-2</a>/<a href="http://en.wikipedia.org/wiki/SHA-3">SHA-3</a> cryptographic hash.),
answer_type => "crypthashcheck"
),
'hash a8a35ab9036388fd42fe1d73d93ede7ec604044ba4753259fafbf718' => test_zci(
- qq(This is a 224 bit SHA-2 cryptographic hash.),
- html => qq(This is a 224 bit <a href="http://en.wikipedia.org/wiki/SHA-2">SHA-2</a> cryptographic hash.),
+ qq(This is a 224 bit SHA-2/SHA-3 cryptographic hash.),
+ html => qq(This is a 224 bit <a href="http://en.wikipedia.org/wiki/SHA-2">SHA-2</a>/<a href="http://en.wikipedia.org/wiki/SHA-3">SHA-3</a> cryptographic hash.),
answer_type => "crypthashcheck"
),
Please sign in to comment.
Something went wrong with that request. Please try again.