Skip to content

Instantly share code, notes, and snippets.

@endreszabo
Last active March 17, 2016 15:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save endreszabo/553cf2a10c1f133c7980 to your computer and use it in GitHub Desktop.
Save endreszabo/553cf2a10c1f133c7980 to your computer and use it in GitHub Desktop.
Perl that XORs.. for science!
#!/usr/bin/env perl
use strict;
use warnings;
use utf8;
use List::Util qw( shuffle );
my $o='`^._-=>;:/()|[]{}#@%+$&?*~,"';
my $s=join(" ",@ARGV)||"egyenisegek vagytok mind!";
sub xorsplit($){my$oa;my$ob;out:foreach my$c(split//,shift){foreach my$a(shuffle split//,$o){foreach my$b(shuffle split//,$o){if((ord($a)^(ord($b)))==ord($c)){$oa.=$a; $ob.=$b;next out;}}}printf"Failed looking up '%s'\n",$c;}return($oa,$ob);}
printf"use re 'eval';''=~('(?{'.('%s'^'%s').',\$\/})')\n",xorsplit("print \"$s\"");
printf"yes|perl -pe'\$_=q\"%s\"|q\"%s\"",xorsplit($s);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment