comparison roundup/password.py @ 4760:efdce3d32698

Increase generated password length to 12 symbols. Make sure at least one digit is present. See article of Georgia Tech Research Institute at http://goo.gl/olFxy for more information.
author anatoly techtonik <techtonik@gmail.com>
date Mon, 18 Feb 2013 00:42:08 +0300
parents 2f66d44616ad
children 9ba03348f923
comparison
equal deleted inserted replaced
4759:fd90ad41d34d 4760:efdce3d32698
163 s = plaintext 163 s = plaintext
164 else: 164 else:
165 raise PasswordValueError, 'Unknown encryption scheme %r'%scheme 165 raise PasswordValueError, 'Unknown encryption scheme %r'%scheme
166 return s 166 return s
167 167
168 def generatePassword(length=8): 168 def generatePassword(length=12):
169 chars = string.letters+string.digits 169 chars = string.letters+string.digits
170 return ''.join([random.choice(chars) for x in range(length)]) 170 password = [random.choice(chars) for x in range(length)]
171 # make sure there is at least one digit
172 password[0] = random.choice(string.digits)
173 random.shuffle(password)
174 return ''.join(password)
171 175
172 class JournalPassword: 176 class JournalPassword:
173 """ Password dummy instance intended for journal operation. 177 """ Password dummy instance intended for journal operation.
174 We do not store passwords in the journal any longer. The dummy 178 We do not store passwords in the journal any longer. The dummy
175 version only reads the encryption scheme from the given 179 version only reads the encryption scheme from the given

Roundup Issue Tracker: http://roundup-tracker.org/