The overhead is very little more than using MIME::Base64. The (untested) "decrypting" script:

#!/usr/bin/perl use strict; use warnings; use Digest::MD5 qw( md5_hex ); use List::Util qw( max ); my $participants_qfn = 'santaList.txt'; # Name#email my $previous_qfn = 'lastYear.txt'; # sorted md5 hashes my @participants = do { open(my $fh, '<', $participants_qfn) or die $!; map { /^(.*?)#/ ? $1 : () } <$fh> }; my %previous = do { open(my $fh, '<', $previous_qfn) or die $!; map { /^(.*)/ ? $1 => 1 : () } <$fh> }; my $longest = max map length, @participants; my %givers = map { $_ => 1 } @participants; my %recvers = map { $_ => 1 } @participants; my %gives_to; for my $giver (@participants) { while ( my ($recver) = each %recvers ) { next if $giver eq $recver; my $hash = md5_hex($giver, '=>', $gives_to{$recver}); next if !$previous{$hash}; $gives_to{$giver} = $recver; delete $givers{$giver}; delete $recvers{$recver}; last; } keys %to; # Reset iterator. } { my $fmt = "%-${longest}s => %s\n"; print("Matched\n"); print("=======\n"); printf($fmt, $_, $gives_to{$_}) for sort keys %gives_to; print("Unmatched Givers\n"); print("================\n"); print("$_\n") for sort keys %givers; print("Unmatched Receivers\n"); print("===================\n"); print("$_\n") for sort keys %recvers; }

I realise this isn't a place where security is critical. I just wanted to introduce you to security thinking for future reference.

By the way, change
open INPUT, '<' . $participantsFile
to
open INPUT, '<', $participantsFile
for free benefits. It wouldn't hurt to add at least the very simple "or die $!;".


In reply to Re^4: Temporarily Obscuring a Lottery Draw by ikegami
in thread Temporarily Obscuring a Lottery Draw by kennethk

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.