0 #!/usr/bin/perl 1 # file: generate_vrns.pl 2 use constant DIGITS => 100; 3 my $id_count = shift; 4 for (1..$id_count) { 5 my $digits = random_digits(DIGITS); 6 $digits =~ s/(.{25})/$1\n/g; 7 print <<EOB; 8 --REGISTRATION-START-- 9 $digits--REGISTRATION-END-- 10 EOB 11 } 12 sub random_digits { 13 my $digits_desired = shift; 14 open(RAND,'/dev/urandom') or die "Can't open random number device: $!"; 15 my $data; 16 read(RAND,$data,$digits_desired) or die "Can't read random bytes: $!"; 17 my @digits = map {$_ % 10} unpack('C*',$data); 18 return join '', @digits[0..$digits_desired-1]; 19 }

Secure Internet Voting with Perl
Related Reading
More Insights
INFO-LINK
![]() |
To upload an avatar photo, first complete your Disqus profile. | View the list of supported HTML tags you can use to style comments. | Please read our commenting policy. |