diff --git a/lib/DDG/Goodie/Rc4.pm b/lib/DDG/Goodie/Rc4.pm index 538e651bb..579f608f4 100644 --- a/lib/DDG/Goodie/Rc4.pm +++ b/lib/DDG/Goodie/Rc4.pm @@ -35,7 +35,7 @@ handle remainder => sub { return unless $type && $key && $plaintext; - if ($type eq "encrypt" || $type eq "en" || $type eq "enc") { + if ($type =~ m/en(c|crypt)?/) { # To encrypt we receive the plaintext as is and pass it to the RC4 function. my $encrypted = RC4($key, $plaintext); # To avoid problems with non printable characters, we transform the result using encode_base64() @@ -43,14 +43,15 @@ handle remainder => sub { chomp $result; $operation = "Rc4 Encryption"; - } - if ($type eq "decrypt" || $type eq "de" || $type eq "dec") { + } elsif ($type =~ m/de(c|crypt)?/) { #To decrypt we do the reverse process, we take the plaintext, transform it using decode_base64() my $decoded = decode_base64($plaintext); # Then we pass it to the RC4 funcion to be decrypted. $result = RC4($key, $decoded); # No need to encode again, this result is show as is. $operation = "Rc4 Decryption"; + } else { + return; } return $result, diff --git a/share/goodie/rc4/dist.ini b/share/goodie/rc4/dist.ini new file mode 100644 index 000000000..4471a41d3 --- /dev/null +++ b/share/goodie/rc4/dist.ini @@ -0,0 +1,141 @@ +name = DDG-GoodieBundle-OpenSourceDuckDuckGo +author = Gabriel Weinberg +author = Torsten Raudssus +author = Michael Smith +author = Hunter Lang +license = Apache_2_0 +copyright_holder = DuckDuckGo, Inc. L +copyright_year = 2013 + +[PromptIfStale] +index = http://duckpan.org +module = Dist::Zilla::Plugin::UploadToDuckPAN + +[Prereqs] +Time::Duration = 1.1 +MIME::Base64 = 3.13 +MIME::Types = 0 +Roman = 1.23 +Fortune = 0.2 +Math::Int2Base = 1.00 +Data::GUID = 0.046 +IO::All = 0.44 +File::ShareDir::ProjectDistDir = 0.2.0 +Text::FIGlet = 2.19.3 +Text::Unidecode = 0.04 +Date::Calc = 6.3 +Date::Hijri = 0.02 +Date::Jalali2 = 0.04 +Date::Leapyear = 1.72 +; Dates role, et. al. +DateTime = 0.74 +DateTime::Format::HTTP = 0 +Devel::StackTrace = 0 +Package::Stash = 0 +Try::Tiny = 0 +Lingua::EN::Numericalize = 1.52 +Lingua::PigLatin = 0.01 +Locale::SubCountry = 1.47 +; causing problems because not pp: HTML::Barcode::QRCode = 0.09 +Unicode::Char = 0.02 +Number::UN = 0.002 +Locale::Codes = 3.30 +Gravatar::URL = 1.06 +CGI = 3.60 +Email::Valid = 1.192 +Net::Domain::TLD = 1.70 +Convert::Pluggable = 0.026 +YAML = 0 +Encode = 2.62 +; ParseCron +Schedule::Cron::Events = 0 +; ColorCodes +Color::Library = 0 +Convert::Color = 0.08 +Convert::Color::Library = 0.03 +Convert::Braille = 0.05 +Math::Round = 0.06 +Convert::Morse = 0.05 +Net::IDN::Encode = 2.003 +Astro::MoonPhase = 0 +Acme::rafl::Everywhere = 0.008 +Lingua::EN::Numbers::Ordinate = 1.02 +; Hashes +Digest::SHA = 5.82 +Digest::MD5 = 2.53 +; Factors +Math::Prime::Util = 0.43 +Games::Sudoku::Component = 0.02 +Data::RandomPerson = 0.4 +Lingua::EN::Words2Nums = 0 +Locale::Currency::Format = 1.30 +Net::IP = 0 +Math::BaseConvert = 0 +Telephony::CountryDialingCodes = 1.04 +URI::Escape::XS = 0.12 +DateTime::Calendar::Chinese = 1.00 +DateTime::Event::Chinese = 1.00 +DateTime::Event::Sunrise = 0 +Geo::Coordinates::DecimalDegrees = 0.09 +Math::SigFigs = 1.09 +Bit::Vector = 7.3 +List::MoreUtils = 0 +; FlipText +Text::UpsideDown = 1.22 +; Parser BinaryLogic +Marpa::R2 = 0 +; For pre-fetch Goodies only. +LWP::Simple = 0 +Business::CUSIP = 1.03 +; Added for SimpleEncryptionService +Crypt::RC4 + +[Prereqs / TestRequires] +Test::EOL = 0 +Test::MockTime = 0 +Test::More = 0.98 +Test::Most = 0 +Test::Dirs = 0.03 +File::Temp = 0.22 + +[GatherDir] +[PruneCruft] +[ManifestSkip] +[ExtraTests] +[ExecDir] +[ShareDir] +[MakeMaker] +[Manifest] +[TestRelease] +[ConfirmRelease] +[UploadToDuckPAN] +[MetaJSON] +[MetaYAML] + +[AutoModuleShareDirs] +scan_namespaces = DDG::Goodie,DDG::Spice +sharedir_method = module_share_dir + +[Git::NextVersion] +version_regexp = ^(.+)$ +[PkgVersion] +[PodSyntaxTests] +[GithubMeta] +[Test::EOL] +trailing_whitespace = 0 +[@Git] +tag_format = %v + +[PodWeaver] + +[Git::Push] +push_to = origin master + +[TravisCI] +perl_version = 5.16 +perl_version = 5.18 +extra_dep = App::DuckPAN +extra_dep = autodie +after_install = duckpan DDG +before_install = sudo apt-get update -qq +before_install = sudo apt-get install -y libmpfr-dev