pwgen.pl
author Peter Gervai <grin@grin.hu>
Wed, 07 May 2014 16:25:00 +0200
changeset 0 624a9ab34425
child 3 d4bb4405d439
permissions -rwxr-xr-x
Add code lying around to the repo
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
0
624a9ab34425 Add code lying around to the repo
Peter Gervai <grin@grin.hu>
parents:
diff changeset
     1
#!/usr/bin/perl
624a9ab34425 Add code lying around to the repo
Peter Gervai <grin@grin.hu>
parents:
diff changeset
     2
# $Id$
624a9ab34425 Add code lying around to the repo
Peter Gervai <grin@grin.hu>
parents:
diff changeset
     3
# (c)Peter Gervai, 2002; Released under GPLv2 + CC_BY-SA-2.0
624a9ab34425 Add code lying around to the repo
Peter Gervai <grin@grin.hu>
parents:
diff changeset
     4
#
624a9ab34425 Add code lying around to the repo
Peter Gervai <grin@grin.hu>
parents:
diff changeset
     5
# jelszogenerator, 2002/04/08
624a9ab34425 Add code lying around to the repo
Peter Gervai <grin@grin.hu>
parents:
diff changeset
     6
#
624a9ab34425 Add code lying around to the repo
Peter Gervai <grin@grin.hu>
parents:
diff changeset
     7
624a9ab34425 Add code lying around to the repo
Peter Gervai <grin@grin.hu>
parents:
diff changeset
     8
if( $ARGV[0] =~ /shutup/i ) { $shutup = 1; $num=1; } else { $num = 6; }
624a9ab34425 Add code lying around to the repo
Peter Gervai <grin@grin.hu>
parents:
diff changeset
     9
624a9ab34425 Add code lying around to the repo
Peter Gervai <grin@grin.hu>
parents:
diff changeset
    10
$vowel='aeiou';
624a9ab34425 Add code lying around to the repo
Peter Gervai <grin@grin.hu>
parents:
diff changeset
    11
#$cons='bcdfghjklmnpqrstvwxyz';
624a9ab34425 Add code lying around to the repo
Peter Gervai <grin@grin.hu>
parents:
diff changeset
    12
 $cons='bcdfghjklmnprstvxyz';
624a9ab34425 Add code lying around to the repo
Peter Gervai <grin@grin.hu>
parents:
diff changeset
    13
624a9ab34425 Add code lying around to the repo
Peter Gervai <grin@grin.hu>
parents:
diff changeset
    14
$vlen=length($vowel);
624a9ab34425 Add code lying around to the repo
Peter Gervai <grin@grin.hu>
parents:
diff changeset
    15
$clen=length($cons);
624a9ab34425 Add code lying around to the repo
Peter Gervai <grin@grin.hu>
parents:
diff changeset
    16
624a9ab34425 Add code lying around to the repo
Peter Gervai <grin@grin.hu>
parents:
diff changeset
    17
624a9ab34425 Add code lying around to the repo
Peter Gervai <grin@grin.hu>
parents:
diff changeset
    18
$longsyl=20; # percent
624a9ab34425 Add code lying around to the repo
Peter Gervai <grin@grin.hu>
parents:
diff changeset
    19
$sylnum=4 + rand(3);
624a9ab34425 Add code lying around to the repo
Peter Gervai <grin@grin.hu>
parents:
diff changeset
    20
624a9ab34425 Add code lying around to the repo
Peter Gervai <grin@grin.hu>
parents:
diff changeset
    21
print "$num tok jo jelszo: " unless $shutup;
624a9ab34425 Add code lying around to the repo
Peter Gervai <grin@grin.hu>
parents:
diff changeset
    22
624a9ab34425 Add code lying around to the repo
Peter Gervai <grin@grin.hu>
parents:
diff changeset
    23
624a9ab34425 Add code lying around to the repo
Peter Gervai <grin@grin.hu>
parents:
diff changeset
    24
624a9ab34425 Add code lying around to the repo
Peter Gervai <grin@grin.hu>
parents:
diff changeset
    25
for (1..$num) {
624a9ab34425 Add code lying around to the repo
Peter Gervai <grin@grin.hu>
parents:
diff changeset
    26
    for my $i (1..$sylnum) {
624a9ab34425 Add code lying around to the repo
Peter Gervai <grin@grin.hu>
parents:
diff changeset
    27
        print substr($cons,rand($clen),1);
624a9ab34425 Add code lying around to the repo
Peter Gervai <grin@grin.hu>
parents:
diff changeset
    28
        print substr($vowel,rand($vlen),1);
624a9ab34425 Add code lying around to the repo
Peter Gervai <grin@grin.hu>
parents:
diff changeset
    29
        print substr($cons,rand($clen),1) if $longsyl > rand(100);
624a9ab34425 Add code lying around to the repo
Peter Gervai <grin@grin.hu>
parents:
diff changeset
    30
        #print "-";
624a9ab34425 Add code lying around to the repo
Peter Gervai <grin@grin.hu>
parents:
diff changeset
    31
    }
624a9ab34425 Add code lying around to the repo
Peter Gervai <grin@grin.hu>
parents:
diff changeset
    32
    print "  " unless $shutup;
624a9ab34425 Add code lying around to the repo
Peter Gervai <grin@grin.hu>
parents:
diff changeset
    33
}
624a9ab34425 Add code lying around to the repo
Peter Gervai <grin@grin.hu>
parents:
diff changeset
    34
624a9ab34425 Add code lying around to the repo
Peter Gervai <grin@grin.hu>
parents:
diff changeset
    35
print "\n";
624a9ab34425 Add code lying around to the repo
Peter Gervai <grin@grin.hu>
parents:
diff changeset
    36
print "\n" unless $shutup;