summaryrefslogtreecommitdiff
path: root/Master/tlpkg/tlperl/bin/makerandom
blob: 29b21c6608cc74f114e8c3a439d4aed3ef9c19b8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
#!/usr/bin/perl -sI../lib -Ilib/
##
## makerandom - interface to crypt::random
##
## Copyright (c) 1998, Vipul Ved Prakash.  All rights reserved.
## This code is free software; you can redistribute it and/or modify
## it under the same terms as Perl itself.
##
## $Id: makerandom,v 1.1.1.1 2001/06/21 15:34:49 vipul Exp $

use Crypt::Random qw( makerandom makerandom_itv );

unless ( $size || $lower )  { 
    my $name = $0; 
    $name =~ s:.*/::;
    print "usage: $name [options] \
       -size=bitsize \
       -strength=[01] \
       -dev=device \ 
       -lower=lower_bound \
       -upper=upper_bound \
       -num=quantity\n\n";
    exit 0;
}


$strength = 0 unless $strength; 
my $i     = 1; 
   $num   = 1 unless $num; 

while ( $i++ <= $num ) { 

my $r; 

if ( $size ) { 
    $r = makerandom Size => $size, 
                    Strength => $strength,
                    Device => $dev; 
}

if ( $lower ) { 
    $r = makerandom_itv Lower => $lower, 
                        Upper => $upper, 
                        Strength => $strength, 
                        Device => $dev;
}

print "$r\n";

}