in reply to Temporarily Obscuring a Lottery Draw

If I understand your question correct, then you only need to discover repeated pairings, no need to save the concrete names (but see below) ?

You could normalise a pair (e.g. sort alphabetically → "Lois,Tarzan" or "Clark,Jane"), pipe that through an MD5 or SHA1 and save this obfuscated pair (e.g. a line of hex digits: affe8deadbeef0815.... etc.) into a text file. It should be obfuscated enough to scare the occasional snoop. Your script would test for a duplicate by generating the hash for the pair to test and look it up in the list of historical pairings hashes. When found, start a new draw.

Instead of running an eMail distribution-script once a year, run the Secret Santa script once a year and let it send the eMails in the same turn. After the script terminates, the concrete names are lost, but the file is updated with a couple of new pairings (hashes) to avoid duplicated pairings for next year's run. If your number of pairs is large, a faster and more compact way to save the pairings is required.

  • Comment on Re: Temporarily Obscuring a Lottery Draw

Replies are listed 'Best First'.
Re^2: Temporarily Obscuring a Lottery Draw
by andreas1234567 (Vicar) on Nov 03, 2008 at 09:08 UTC
    pipe that through an MD5 or SHA1
    .. or even the brand new Skein algorithm from Schneier et al. available as Digest::Skein on CPAN:
    use strict; use warnings; use Digest::Skein; print Digest::Skein->new(256)->add('foo bar baz')->hexdigest; __END__ $ perl -wl skein.pl 9b575b4eb237749e706e81f54ac35fdcefff522297161770b8a2c3457c317a4d
    --
    No matter how great and destructive your problems may seem now, remember, you've probably only seen the tip of them. [1]