Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/local/bin/python
- # -*- coding: UTF-8 -*-
- #
- # Copyright (c) 2010, Mikhail Babich <bma@bma.su>
- # All rights reserved.
- #
- from crypt import crypt
- from sys import exit, argv
- from os import urandom
- from random import seed, choice
- from getpass import getpass
- SALT_ARRAY = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNO" \
- "PQRSTUVWXYZ1234567890-=][';/.,<>?:{}+_)(*&^%$#@!`~"
- def init():
- seed(urandom(13))
- def make_crypt(word):
- return crypt(word, choice(SALT_ARRAY) + choice(SALT_ARRAY))
- def main():
- init()
- try:
- username = raw_input("Username: ")
- except:
- return 1
- try:
- p1 = getpass("Password: ")
- p2 = getpass("Again: ")
- except:
- return 1
- if p1 != p2:
- print("Password not match")
- return 1
- print "{user}:{crypt}".format(user=username, crypt=make_crypt(p1))
- return 0
- if __name__ == '__main__':
- exit(main())
Add Comment
Please, Sign In to add comment