Remove use of html_enc (#3571)

* Rot13: Remove HTML Encoding from output text

* Scramble: Remove HTML Encoding from output text

* Remove html encoding from TimezoneConverter and TitleCase IAs

* RIPEMD: Remove HTML encoding from output text

* Regexp: Remove HTML encoding

* Remove html_enc from NameDays and MD5 IAs

* Remove html_enc from MD4 and IDN

* FIGlet: Remove html enc

* Remove html enc from CaesarCipher and Braille

* Atbash: Remove html_enc from output text

* MD4: Simplify string concatenation in perl way

* NameDays: Simplify string concatenation the perl way

* NameDays: Refactor string concatenation
master
Sahil Dua 2016-08-31 20:58:57 +02:00 committed by Ben Moon
parent 89ab9f322f
commit f13d396b5d
23 changed files with 56 additions and 60 deletions

View File

@ -31,7 +31,7 @@ handle remainder => sub {
structured_answer => {
data => {
title => "$result",
subtitle => html_enc("Atbash: $in_string")
subtitle => "Atbash: $in_string"
},
templates => {
group => 'text',

View File

@ -34,7 +34,7 @@ handle query_raw => sub {
structured_answer => {
data => {
title => $response,
subtitle => 'Braille translation: ' . html_enc($query),
subtitle => "Braille translation: $query",
},
templates => {
group => 'text',

View File

@ -93,7 +93,7 @@ handle remainder => sub {
structured_answer => {
data => {
title => "$result",
subtitle => html_enc("Caesar cipher $shift_val $to_cipher"),
subtitle => "Caesar cipher $shift_val $to_cipher",
},
templates => {
group => 'text',

View File

@ -53,10 +53,6 @@ handle query => sub {
return unless $figlet;
if ($font eq 'rot13' || $font eq 'mnemonic' || $font eq 'term') {
$figlet = html_enc($figlet);
}
return $figlet,
structured_answer => {
data => {

View File

@ -19,10 +19,10 @@ handle query_lc => sub {
$idn = 'internationalized domain: ' if $1 eq 'internationalize domain';
return unless m/\.(ac|ad|ae|aero|af|ag|ai|al|am|an|ao|aq|ar|arpa|as|asia|at|au|aw|ax|az|ba|bb|bd|be|bf|bg|bh|bi|biz|bj|bm|bn|bo|br|bs|bt|bv|bw|by|bz|ca|cat|cc|cd|cf|cg|ch|ci|ck|cl|cm|cn|co|com|coop|cr|cu|cv|cw|cx|cy|cz|de|dj|dk|dm|do|dz|ec|edu|ee|eg|er|es|et|eu|fi|fj|fk|fm|fo|fr|ga|gb|gd|ge|gf|gg|gh|gi|gl|gm|gn|gov|gp|gq|gr|gs|gt|gu|gw|gy|hk|hm|hn|hr|ht|hu|id|ie|il|im|in|info|int|io|iq|ir|is|it|je|jm|jo|jobs|jp|ke|kg|kh|ki|km|kn|kp|kr|kw|ky|kz|la|lb|lc|li|lk|local|lr|ls|lt|lu|lv|ly|ma|mc|md|me|mg|mh|mil|mk|ml|mm|mn|mo|mobi|mp|mq|mr|ms|mt|mu|museum|mv|mw|mx|my|mz|na|name|nc|ne|net|nf|ng|ni|nl|no|np|nr|nu|nz|om|org|pa|pe|pf|pg|ph|pk|pl|pm|pn|pr|pro|ps|pt|pw|py|qa|re|ro|rs|ru|rw|sa|sb|sc|sd|se|sg|sh|si|sj|sk|sl|sm|sn|so|sr|st|su|sv|sx|sy|sz|tc|td|tel|tf|tg|th|tj|tk|tl|tm|tn|to|tp|tr|travel|tt|tv|tw|tz|ua|ug|uk|us|uy|uz|va|vc|ve|vg|vi|vn|vu|wf|ws|xxx|ye|yt|za|zm|zw)$/i;
if(/^xn--/) {
return 'Decoded ' . $idn . html_enc(domain_to_unicode($_));
return 'Decoded ' . $idn . domain_to_unicode($_);
}
else {
return 'Encoded ' . $idn . html_enc(domain_to_ascii($_));
return 'Encoded ' . $idn . domain_to_ascii($_);
}
return;
};

View File

@ -35,8 +35,8 @@ handle remainder => sub {
return $out, structured_answer => {
data => {
title => html_enc($out),
subtitle => html_enc('MD4 ' . $enc . ' hash').": " .html_enc($str)
title => $out,
subtitle => "MD4 $enc hash: $str"
},
templates => {
group => 'text'

View File

@ -34,7 +34,7 @@ handle remainder => sub {
return $md5, structured_answer => {
data => {
title => $md5,
subtitle => "MD5 $format hash: ". html_enc($str)
subtitle => "MD5 $format hash: $str"
},
templates => {
group => 'text'

View File

@ -91,7 +91,7 @@ handle remainder => sub {
# Search by name first
$query = ucfirst($_);
($text, $html) = split('\|', $dates{lc($_)});
$header = 'Name days for <b>' . html_enc($query) . '</b>';
$header = "Name days for <b>$query</b>";
} else {
# Then, search by date
my $day = parse_datestring_to_date($_);
@ -120,12 +120,12 @@ handle remainder => sub {
' <span class="name-days-country-name">' . $1 . '</span>' .
'</td><td class="name-days-dates">' . $2 . '</td></tr>'@ge;
$header = 'Name days on <b>' . html_enc($query) . '</b>';
$header = "Name days on <b>$query</b>";
}
# Add the header
$html = '<div class="zci--name_days">' .
'<span>' . $header . '</span>' .
"<span>$header</span>" .
'<div class="zci__content"><table>' .
$html . '</table></div></div>';

View File

@ -49,8 +49,8 @@ handle query => sub {
my $operation = 'RIPEMD-' . $ver . ' ' . $enc . ' hash';
return $out, structured_answer => {
data => {
title => html_enc($out),
subtitle => "$operation: " . html_enc($str)
title => $out,
subtitle => "$operation: $str"
},
templates => {
group => 'text'

View File

@ -79,7 +79,7 @@ handle query => sub {
structured_answer => {
data => {
title => "Regular Expression Match",
subtitle => html_enc("Match regular expression /$regexp/$modifiers on $str"),
subtitle => "Match regular expression /$regexp/$modifiers on $str",
record_data => $matches,
record_keys => \@key_order,
},

View File

@ -19,8 +19,8 @@ handle remainder => sub {
return "ROT13: $out", structured_answer => {
data => {
title => html_enc($out),
subtitle => "ROT13: ".html_enc($in)
title => $out,
subtitle => "ROT13: $in"
},
templates => {
group => 'text'

View File

@ -48,8 +48,8 @@ handle remainder_lc => sub {
return "$operation $word", structured_answer => {
data => {
title => html_enc($response),
subtitle => html_enc("$operation: $word")
title => $response,
subtitle => "$operation: $word"
},
templates => {
group => 'text'

View File

@ -174,8 +174,8 @@ handle query => sub {
return $output_string, structured_answer => {
data => {
title => html_enc($output_string),
subtitle => "Convert Timezone: ".html_enc($input_string)
title => $output_string,
subtitle => "Convert Timezone: $input_string"
},
templates => {
group => 'text'

View File

@ -31,8 +31,8 @@ handle remainder => sub {
return $title_case, structured_answer => {
data => {
title => html_enc($title_case),
subtitle => 'Title case: '.html_enc($input)
title => $title_case,
subtitle => "Title case: $input"
},
templates => {
group => 'text'

View File

@ -44,7 +44,7 @@ ddg_goodie_test(
structured_answer => {
data => {
title => "Tlmmz kzigb orpv rg'h 1999!",
subtitle => "Atbash: Gonna party like it&#39;s 1999!"
subtitle => "Atbash: Gonna party like it's 1999!"
},
templates => {
group => 'text',

View File

@ -35,9 +35,9 @@ ddg_goodie_test(
'translate to braille to braille' => build_test('translate to braille', '⠞⠗⠁⠝⠎⠇⠁⠞⠑⠀⠞⠕⠀⠃⠗⠁⠊⠇⠇⠑'),
'braille: asdf k' => build_test('asdf k', '⠁⠎⠙⠋⠀⠅'),
# Braille -> Ascii/Unicode
'⠓⠑⠀⠇⠇⠕' => build_test('&#x2813;&#x2811;&#x2800;&#x2807;&#x2807;&#x2815;', 'he llo'),
'⠞⠗⠁⠝⠎⠇⠁⠞⠑⠀⠞⠕⠀⠃⠗⠁⠊⠇⠇⠑' => build_test('&#x281E;&#x2817;&#x2801;&#x281D;&#x280E;&#x2807;&#x2801;&#x281E;&#x2811;&#x2800;&#x281E;&#x2815;&#x2800;&#x2803;&#x2817;&#x2801;&#x280A;&#x2807;&#x2807;&#x2811;', 'translate to braille'),
'⠁⠎⠙⠋⠀⠅' => build_test('&#x2801;&#x280E;&#x2819;&#x280B;&#x2800;&#x2805;', 'asdf k'),
'⠓⠑⠀⠇⠇⠕' => build_test('⠓⠑⠀⠇⠇⠕', 'he llo'),
'⠞⠗⠁⠝⠎⠇⠁⠞⠑⠀⠞⠕⠀⠃⠗⠁⠊⠇⠇⠑' => build_test('⠞⠗⠁⠝⠎⠇⠁⠞⠑⠀⠞⠕⠀⠃⠗⠁⠊⠇⠇⠑', 'translate to braille'),
'⠁⠎⠙⠋⠀⠅' => build_test('⠁⠎⠙⠋⠀⠅', 'asdf k'),
# Invalid Queries
'braille asdf k' => undef,
'how long to learn braille' => undef,

View File

@ -56,7 +56,7 @@ ddg_goodie_test(
'caesar -26 test\\' => build_test('test\\', -26, 'test\\'),
'caesar 5 #test{]17TEST#' => build_test('#yjxy{]17YJXY#', 5, '#test{]17TEST#'),
'Caesar cipher 26 test text.' => build_test('test text.', 26, 'test text.'),
'ceasar 13 "More Test Text"' => build_test('"Zber Grfg Grkg"', 13, '&quot;More Test Text&quot;'),
'ceasar 13 "More Test Text"' => build_test('"Zber Grfg Grkg"', 13, '"More Test Text"'),
'shift cipher 7 Mxlm mxqm' => build_test('Test text', 7, 'Mxlm mxqm'),
'caesar cipher hello' => undef,
'caesar cipher' => undef,

View File

@ -157,11 +157,11 @@ ddg_goodie_test(
),
'figlet rot13 </fpevcg>' => test_zci(
"&lt;/script&gt;
"</script>
",
structured_answer => {
data => {
title => "&lt;/script&gt;
title => "</script>
",
subtitle => "Font: rot13",
},
@ -172,11 +172,11 @@ ddg_goodie_test(
),
'figlet mnemonic </script>' => test_zci(
"&lt;/script&gt;
"</script>
",
structured_answer => {
data => {
title => "&lt;/script&gt;
title => "</script>
",
subtitle => "Font: mnemonic",
},
@ -187,11 +187,11 @@ ddg_goodie_test(
),
'figlet term </script>' => test_zci(
"&lt;/script&gt;
"</script>
",
structured_answer => {
data => {
title => "&lt;/script&gt;
title => "</script>
",
subtitle => "Font: term",
},

View File

@ -20,11 +20,11 @@ ddg_goodie_test(
'internationalize domain exämple.com' =>
test_zci('Encoded internationalized domain: xn--exmple-cua.com'),
'idn xn--exmple-cua.com' =>
test_zci('Decoded IDN: ex&auml;mple.com'),
test_zci('Decoded IDN: exämple.com'),
'international domain xn--exmple-cua.com' =>
test_zci('Decoded international domain: ex&auml;mple.com'),
test_zci('Decoded international domain: exämple.com'),
'internationalized domain xn--exmple-cua.com' =>
test_zci('Decoded internationalized domain: ex&auml;mple.com'),
test_zci('Decoded internationalized domain: exämple.com'),
);
done_testing;

View File

@ -32,8 +32,8 @@ ddg_goodie_test(
'md4 hash this string' => build_test('053067f13569dab01dbb0fcbfef3dffa', "hex", "this string"),
'md4 hash of this string' => build_test('053067f13569dab01dbb0fcbfef3dffa',"hex", "this string"),
'md4 base64 this string' => build_test('BTBn8TVp2rAduw/L/vPf+g==', "base64", "this string"),
'md4 <script>alert("ddg")</script>' => build_test('5b9b4baf02269790c6f1c6ad0fecf55b', "hex", '&lt;script&gt;alert(&quot;ddg&quot;)&lt;/script&gt;'),
'md4 & / " \\\' ; < >' => build_test('34a291b941a1754761cbf345d518b985', "hex", '&amp; / &quot; \&#39; ; &lt; &gt;'),
'md4 <script>alert("ddg")</script>' => build_test('5b9b4baf02269790c6f1c6ad0fecf55b', "hex", '<script>alert("ddg")</script>'),
'md4 & / " \\\' ; < >' => build_test('34a291b941a1754761cbf345d518b985', "hex", '& / " \\\' ; < >'),
'md5 this string' => undef,
);

View File

@ -32,7 +32,7 @@ ddg_goodie_test(
'md5sum the sum of a string' => build_test('a704c8833f9850cd342ead27207ca1a1', "hex", "the sum of a string"),
'md5 of password' => build_test('5f4dcc3b5aa765d61d8327deb882cf99', "hex", "password"),
'md5sum of "this"' => build_test('9e925e9341b490bfd3b4c4ca3b0c1ef2', "hex", "this"),
'md5 of "this' => build_test('53d3e72f097a74f6d439fa88b91d5a71', "hex", '&quot;this'),
'md5 of "this' => build_test('53d3e72f097a74f6d439fa88b91d5a71', "hex", '"this'),
'md5 hash' => build_test('0800fc577294c34e0b28ad2839435945', "hex", "hash"),
'md5 hash ' => build_test('0800fc577294c34e0b28ad2839435945', "hex", "hash"),
'md5 hash of' => build_test('8bf8854bebe108183caeb845c7676ae4', "hex", "of"),
@ -45,9 +45,9 @@ ddg_goodie_test(
'md5 hex "duckduckgo"' => build_test('96898bb8544fa56b03c08cdc09886c6c', "hex", "duckduckgo"),
'md5 hex base64' => build_test('95a1446a7120e4af5c0c8878abb7e6d2', "hex", "base64"),
'md5 base64 this string' => build_test('xzix7ki/mKlygQ8V94J05Q==', "base64", "this string"),
'md5sum <script>alert( "hello" )<script>' => build_test('57757f49c3ceb9d1b65c3b5ca0b5bd2d', "hex", '&lt;script&gt;alert( &quot;hello&quot; )&lt;script&gt;'),
'md5sum script>ALERT hello script>' => build_test('a5e4903040077d90e9dd32da99d01b91', "hex", 'script&gt;ALERT hello script&gt;'),
'md5sum & / " \' ; < > ' => build_test('48ff1acf53de360edc32cabd5b30e7b4',"hex", '&amp; / &quot; &#39; ; &lt; &gt;'),
'md5sum <script>alert( "hello" )<script>' => build_test('57757f49c3ceb9d1b65c3b5ca0b5bd2d', "hex", '<script>alert( "hello" )<script>'),
'md5sum script>ALERT hello script>' => build_test('a5e4903040077d90e9dd32da99d01b91', "hex", 'script>ALERT hello script>'),
'md5sum & / " \' ; < > ' => build_test('48ff1acf53de360edc32cabd5b30e7b4',"hex", "& / \" \' ; < >"),
);
done_testing;

View File

@ -34,23 +34,23 @@ ddg_goodie_test(
'ripemd128sum this string' => build_test('bb5fe1c296fa5d94d1c9202511df16a7', 'this string', 'RIPEMD-128 hex hash'),
'ripemd128 "this string"' => build_test('bb5fe1c296fa5d94d1c9202511df16a7', 'this string', 'RIPEMD-128 hex hash'),
'ripemd128 hex this string' => build_test('bb5fe1c296fa5d94d1c9202511df16a7', 'this string', 'RIPEMD-128 hex hash'),
'ripemd128 "this and "that" string"' => build_test('f9d2f34b95e10b785745d6595a6d8292', 'this and &quot;that&quot; string', 'RIPEMD-128 hex hash'),
'ripemd128 "this and "that" string"' => build_test('f9d2f34b95e10b785745d6595a6d8292', 'this and "that" string', 'RIPEMD-128 hex hash'),
'ripemd128 hash of this string' => build_test('bb5fe1c296fa5d94d1c9202511df16a7', 'this string', 'RIPEMD-128 hex hash'),
'ripemd128 hash of string' => build_test('8f4b5ffc400e9fe83e33a2e0da3668b6', 'string', 'RIPEMD-128 hex hash'),
'ripemd128 base64 hash of this string' => build_test('u1/hwpb6XZTRySAlEd8Wpw==', 'this string', 'RIPEMD-128 b64 hash'),
'ripemd128 <script>alert("ddg")</script>' => build_test('a595aa732b8f0b078f1ebe0860e248bf', '&lt;script&gt;alert(&quot;ddg&quot;)&lt;/script&gt;', 'RIPEMD-128 hex hash'),
q|ripemd128 & / " \\' ; < >| => build_test('34899b95c71c2d1b591f882bb04f2974', '&amp; / &quot; \&#39; ; &lt; &gt;', 'RIPEMD-128 hex hash'),
'ripemd128 <script>alert("ddg")</script>' => build_test('a595aa732b8f0b078f1ebe0860e248bf', '<script>alert("ddg")</script>', 'RIPEMD-128 hex hash'),
q|ripemd128 & / " \\' ; < >| => build_test('34899b95c71c2d1b591f882bb04f2974', "& / \" \\' ; < >", 'RIPEMD-128 hex hash'),
'ripemd-160 this string' => build_test('33f65617195f9667673865edde5b96721d750046', 'this string', 'RIPEMD-160 hex hash',),
'ripemd-160 base64 this string' => build_test('M/ZWFxlflmdnOGXt3luWch11AEY=', 'this string', 'RIPEMD-160 b64 hash'),
'ripemd160 this string' => build_test('33f65617195f9667673865edde5b96721d750046', 'this string', 'RIPEMD-160 hex hash'),
'ripemd160sum this string' => build_test('33f65617195f9667673865edde5b96721d750046', 'this string', 'RIPEMD-160 hex hash'),
'ripemd160 "this string"' => build_test('33f65617195f9667673865edde5b96721d750046', 'this string', 'RIPEMD-160 hex hash'),
'ripemd160 hex this string' => build_test('33f65617195f9667673865edde5b96721d750046', 'this string', 'RIPEMD-160 hex hash'),
'ripemd160 "this and "that" string"' => build_test('ed53347ee8aeab1d994ffe7c2bdf117a05a25c3a', 'this and &quot;that&quot; string', 'RIPEMD-160 hex hash'),
'ripemd160 "this and "that" string"' => build_test('ed53347ee8aeab1d994ffe7c2bdf117a05a25c3a', 'this and "that" string', 'RIPEMD-160 hex hash'),
'ripemd160 hash of this string' => build_test('33f65617195f9667673865edde5b96721d750046', 'this string', 'RIPEMD-160 hex hash'),
'ripemd160 base64 hash of this string' => build_test('M/ZWFxlflmdnOGXt3luWch11AEY=', 'this string', 'RIPEMD-160 b64 hash'),
'ripemd160 <script>alert("ddg")</script>' => build_test('6d3217e6ae7111236ddedd6a866b0921bdd9eace', '&lt;script&gt;alert(&quot;ddg&quot;)&lt;/script&gt;', 'RIPEMD-160 hex hash'),
q|ripemd160 & / " \\' ; < >| => build_test('e32a3dc548d1b1dc57e1bea093ef1837734f91be', '&amp; / &quot; \&#39; ; &lt; &gt;', 'RIPEMD-160 hex hash'),
'ripemd160 <script>alert("ddg")</script>' => build_test('6d3217e6ae7111236ddedd6a866b0921bdd9eace', '<script>alert("ddg")</script>', 'RIPEMD-160 hex hash'),
q|ripemd160 & / " \\' ; < >| => build_test('e32a3dc548d1b1dc57e1bea093ef1837734f91be', "& / \" \\' ; < >", 'RIPEMD-160 hex hash'),
'RIPEMD-256 that' => build_test('1ff3ee2a8109caf8d33f810cfb7dccaee71824bbb18c2ac65cbf6b175ffe57d1', 'that', 'RIPEMD-256 hex hash'),
'ripemd-256 this string' => build_test('3592bc0d765e41e8855687572cfe19f44d8c18bbe0ccfddab9c8b260985ebb40', 'this string', 'RIPEMD-256 hex hash'),
'ripemd-256 base64 this string' => build_test('NZK8DXZeQeiFVodXLP4Z9E2MGLvgzP3auciyYJheu0A=', 'this string', 'RIPEMD-256 b64 hash'),
@ -58,11 +58,11 @@ ddg_goodie_test(
'ripemd256sum this string' => build_test('3592bc0d765e41e8855687572cfe19f44d8c18bbe0ccfddab9c8b260985ebb40', 'this string', 'RIPEMD-256 hex hash'),
'ripemd256 "this string"' => build_test('3592bc0d765e41e8855687572cfe19f44d8c18bbe0ccfddab9c8b260985ebb40', 'this string', 'RIPEMD-256 hex hash'),
'ripemd256 hex this string' => build_test('3592bc0d765e41e8855687572cfe19f44d8c18bbe0ccfddab9c8b260985ebb40', 'this string', 'RIPEMD-256 hex hash'),
'ripemd256 "this and "that" string"' => build_test('1dc63d877763fab85f9427c89f67a6a72a75851dada6a494ed99e0fb35bdd093', 'this and &quot;that&quot; string', 'RIPEMD-256 hex hash'),
'ripemd256 "this and "that" string"' => build_test('1dc63d877763fab85f9427c89f67a6a72a75851dada6a494ed99e0fb35bdd093', 'this and "that" string', 'RIPEMD-256 hex hash'),
'ripemd256 hash of this string' => build_test('3592bc0d765e41e8855687572cfe19f44d8c18bbe0ccfddab9c8b260985ebb40', 'this string', 'RIPEMD-256 hex hash'),
'ripemd256 base64 hash of this string' => build_test('NZK8DXZeQeiFVodXLP4Z9E2MGLvgzP3auciyYJheu0A=', 'this string', 'RIPEMD-256 b64 hash'),
'ripemd256 <script>alert("ddg")</script>' => build_test('a59f78f4568226e051e8b4df12746d4d631120ee6ad5b375298affc48541bdcf', '&lt;script&gt;alert(&quot;ddg&quot;)&lt;/script&gt;', 'RIPEMD-256 hex hash'),
q|ripemd256 & / " \\' ; < >| => build_test('cc93c15f26ea7ba2827f99340204b7d32ddd2ac3ad3256731a6c04882fb6da4d', '&amp; / &quot; \&#39; ; &lt; &gt;', 'RIPEMD-256 hex hash'),
'ripemd256 <script>alert("ddg")</script>' => build_test('a59f78f4568226e051e8b4df12746d4d631120ee6ad5b375298affc48541bdcf', '<script>alert("ddg")</script>', 'RIPEMD-256 hex hash'),
q|ripemd256 & / " \\' ; < >| => build_test('cc93c15f26ea7ba2827f99340204b7d32ddd2ac3ad3256731a6c04882fb6da4d', "& / \" \\' ; < >", 'RIPEMD-256 hex hash'),
'ripemd-320 this string' => build_test('9098c0143e74a96101dda84df41dfb9ef89e6e61d5db992d77fee635512859ac84b0d6be7af2d6e6', 'this string', 'RIPEMD-320 hex hash'),
'ripemd-320 base64 this string' => build_test('kJjAFD50qWEB3ahN9B37nviebmHV25ktd/7mNVEoWayEsNa+evLW5g==', 'this string', 'RIPEMD-320 b64 hash'),
'ripemd320 this string' => build_test('9098c0143e74a96101dda84df41dfb9ef89e6e61d5db992d77fee635512859ac84b0d6be7af2d6e6', 'this string', 'RIPEMD-320 hex hash'),
@ -70,11 +70,11 @@ ddg_goodie_test(
'ripemd320sum this string' => build_test('9098c0143e74a96101dda84df41dfb9ef89e6e61d5db992d77fee635512859ac84b0d6be7af2d6e6', 'this string', 'RIPEMD-320 hex hash'),
'ripemd320 "this string"' => build_test('9098c0143e74a96101dda84df41dfb9ef89e6e61d5db992d77fee635512859ac84b0d6be7af2d6e6', 'this string', 'RIPEMD-320 hex hash'),
'ripemd320 hex this string' => build_test('9098c0143e74a96101dda84df41dfb9ef89e6e61d5db992d77fee635512859ac84b0d6be7af2d6e6', 'this string', 'RIPEMD-320 hex hash'),
'ripemd320 "this and "that" string"' => build_test('6605365efa91d0739419f8bd061d126fa53bed938e1958dd193cf1156f24dd55984897b88fd3eb26', 'this and &quot;that&quot; string', 'RIPEMD-320 hex hash'),
'ripemd320 "this and "that" string"' => build_test('6605365efa91d0739419f8bd061d126fa53bed938e1958dd193cf1156f24dd55984897b88fd3eb26', 'this and "that" string', 'RIPEMD-320 hex hash'),
'ripemd320 hash of this string' => build_test('9098c0143e74a96101dda84df41dfb9ef89e6e61d5db992d77fee635512859ac84b0d6be7af2d6e6', 'this string', 'RIPEMD-320 hex hash'),
'ripemd320 base64 hash of this string' => build_test('kJjAFD50qWEB3ahN9B37nviebmHV25ktd/7mNVEoWayEsNa+evLW5g==', 'this string', 'RIPEMD-320 b64 hash'),
'ripemd320 <script>alert("ddg")</script>' => build_test('371aece9feb936b50e9e7a07186203c0c363d085a5aa307ae04b3bf1d678413e6b034e1a88a2e948', '&lt;script&gt;alert(&quot;ddg&quot;)&lt;/script&gt;', 'RIPEMD-320 hex hash'),
q|ripemd320 & / " \\' ; < >| => build_test('1049653078fea2c686104216907571b7aad4ca57eba23d515c5dd8c43aa06ec112554ec4664c0e35', '&amp; / &quot; \&#39; ; &lt; &gt;', 'RIPEMD-320 hex hash'),
'ripemd320 <script>alert("ddg")</script>' => build_test('371aece9feb936b50e9e7a07186203c0c363d085a5aa307ae04b3bf1d678413e6b034e1a88a2e948', '<script>alert("ddg")</script>', 'RIPEMD-320 hex hash'),
q|ripemd320 & / " \\' ; < >| => build_test('1049653078fea2c686104216907571b7aad4ca57eba23d515c5dd8c43aa06ec112554ec4664c0e35', "& / \" \\' ; < >", 'RIPEMD-320 hex hash'),
'ripemd512 this string' => undef,
);

View File

@ -39,7 +39,7 @@ ddg_goodie_test([qw( DDG::Goodie::Regexp )],
'Full Match' => 'Harry is awesome',
'Named Capture <name>' => 'Harry',
'Subpattern Match 1' => 'Harry',
}, '/(?&lt;name&gt;Harry|Larry) is awesome/', 'Harry is awesome'),
}, '/(?<name>Harry|Larry) is awesome/', 'Harry is awesome'),
'regex /(he|she) walked away/ he walked away' => build_test({
'Full Match' => 'he walked away',
'Subpattern Match 1' => 'he',
@ -55,7 +55,7 @@ ddg_goodie_test([qw( DDG::Goodie::Regexp )],
'Full Match' => 'DDG::Goodie::Regexp',
'Named Capture <goodie>' => 'Regexp',
'Subpattern Match 1' => 'Regexp',
}, '/^DDG::Goodie::(?&lt;goodie&gt;\w+)$/', 'DDG::Goodie::Regexp'),
}, '/^DDG::Goodie::(?<goodie>\w+)$/', 'DDG::Goodie::Regexp'),
'regexp /foo/ foo' => build_test({
'Full Match' => 'foo',
}, '/foo/', 'foo'),