Created
April 23, 2014 07:38
-
-
Save alejandrobernardis/11205806 to your computer and use it in GitHub Desktop.
Password Generator
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env python | |
| # -*- coding: utf-8 -*- | |
| # Copyright (c) 2013 Asumi Kamikaze Inc. | |
| # Copyright (c) 2013 The Octopus Apps Inc. | |
| # Licensed under the Apache License, Version 2.0 (the "License") | |
| # Author: Alejandro M. Bernardis | |
| # Email: alejandro.bernardis at gmail.com | |
| # Created: 02/Dec/2013 16:48 | |
| import datetime | |
| import hashlib | |
| import string | |
| from random import choice | |
| def secret_key(length=64): | |
| h = '%s|%s|%s|%s' % ( | |
| datetime.datetime.utcnow().strftime('%Y%m%d%H%M%S%f'), | |
| string.ascii_letters, string.digits, '~!@#$%^&*+') | |
| return ''.join([choice(h) for _ in range(length)]) | |
| p = secret_key(8) | |
| ph = hashlib.sha1() | |
| ph.update(p) | |
| title = 'Password Creator:' | |
| print title | |
| print '-'*len(title) | |
| print 'Password:', p | |
| print 'SHA1:', ph.hexdigest() | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env python | |
| # -*- coding: utf-8 -*- | |
| # Copyright (c) 2013 Asumi Kamikaze Inc. | |
| # Copyright (c) 2013 The Octopus Apps Inc. | |
| # Licensed under the Apache License, Version 2.0 (the "License") | |
| # Author: Alejandro M. Bernardis | |
| # Email: alejandro.bernardis at gmail.com | |
| # Created: 02/Dec/2013 16:48 | |
| import datetime | |
| import hashlib | |
| import string | |
| from random import choice | |
| def secret_key(length=64): | |
| h = '%s|%s|%s|%s' % ( | |
| datetime.datetime.utcnow().strftime('%Y%m%d%H%M%S%f'), | |
| string.ascii_letters, string.digits, string.punctuation) | |
| return ''.join([choice(h) for _ in range(length)]) | |
| p = secret_key() | |
| ph = hashlib.sha1() | |
| ph.update(p) | |
| title = 'Password Creator:' | |
| print title | |
| print '-'*len(title) | |
| print 'Password:', p | |
| print 'SHA1:', ph.hexdigest() | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment