Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Generating passwords...

1 view
Skip to first unread message

Mike Meyer

unread,
Jan 26, 1998, 3:00:00 AM1/26/98
to

I thought others might find this usefull. I think it's cute.

<mike

#!/usr/local/bin/python

import string
from rand import choice

vowels = ("a", "e", "i", "o", "u", "y", "ai", "ou", "oy", "ay", "ew", "ow",
"ar", "al", "el", "er", "or", "ax", "ex", "ix", "il")

consonants = ("b", "c", "ch", "d", "dr", "f", "fl", "g", "h", "j", "k", "kn",
"kr", "m", "n", "p", "s", "sh", "sm", "sn", "st", "t", "th", "v",
"z")

class generator:
"Generator objects can be called to create a password."
def __init__(my, invowels = None, inconsonants = None):
"Create the generator"
my.vowels = invowels or vowels
my.consonants = inconsonants or consonants

def __call__(my):
"Generate a password"
return string.join((choice(my.consonants), choice(my.vowels),
choice(my.consonants), choice(my.vowels),
choice(my.consonants), choice(my.vowels)),
'')

# One generic generator for our users.
genp = generator()

if __name__ == '__main__':
import sys

try: count = string.atoi(sys.argv[1])
except: count = 20


while count:
print genp()
count = count - 1

--
Do NOT reply to the address in the From: header. Reply to mwm instead of
bouncenews at the same machine. Mail to bouncenews will be returned with
instructions on reaching me. Sending unsoliticed email I consider commercial
gives me permission to subscribe you to a mail list of my choice.

0 new messages