Skip to content

Commit

Permalink
Merge pull request #23 from andreoss/prob059
Browse files Browse the repository at this point in the history
Fix errors in solution to Problem 59
  • Loading branch information
zoffixznet committed Apr 29, 2015
2 parents 219e6a1 + 0e374a6 commit 2b08b3c
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions categories/euler/prob059-andreoss.pl
Expand Up @@ -65,6 +65,12 @@ sub infix:<XOR>(@cipher, @password) {
for @chunks -> @chunk {

my @password = @chunk[^3] XOR @word;
my $password = as-word @password;

next unless $password ~~ /^^ <[a..z]> ** 3 $$/ ;

my $decrypted = as-word @cipher[$offset .. *] XOR @password;

my $count = [+] do for @common-words.grep({$_ !~~ $w}) -> $word {
elems $decrypted ~~ m:g:i/$word/
}
Expand Down

0 comments on commit 2b08b3c

Please sign in to comment.