in reply to Re: Temporarily Obscuring a Lottery Draw
in thread Temporarily Obscuring a Lottery Draw
May I recommend two improvements?
If you're ok with there being only a single chain — I'd even think it was preferable — then
@matching{@names} = shuffle(@names); # Match 'em up # No one has themselves foreach (@names) { next GENERATE if $_ eq $matching{$_}; }
simplifies to
%matching = ( map { $_, $_ } @names )[ 1..@names*2-1, 0 ];
Another common limit is that B doesn't give to A if A gave to B the previous year. That can be achieved by changing
push @digest, md5_hex($_, '=>', $matching{$_});
to
push @digest, md5_hex(join '<=>', sort $_, $matching{$_});
someone actually bothers to try to crack it
That's *very* easy to do. Say you have "N" participants.
It's even easier than attacking passwords of length 2. Hashing the pairings is merely security theatre. You might as well MIME::Base64 them.
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^3: Temporarily Obscuring a Lottery Draw
by kennethk (Abbot) on Nov 03, 2008 at 16:34 UTC | |
by ikegami (Patriarch) on Nov 03, 2008 at 21:21 UTC |