Revision 748282cb
b/snf-image-helper/snf-passtohash.py | ||
---|---|---|
34 | 34 |
from os.path import basename |
35 | 35 |
from optparse import OptionParser |
36 | 36 |
|
37 |
|
|
37 | 38 |
def random_salt(length=8): |
38 | 39 |
pool = ascii_letters + digits + "/" + "." |
39 | 40 |
return ''.join(choice(pool) for i in range(length)) |
40 | 41 |
|
42 |
|
|
41 | 43 |
METHOD = { |
42 | 44 |
# Name: (algoritm, options) |
43 | 45 |
'md5': (passlib.hash.md5_crypt, {}), |
... | ... | |
51 | 53 |
'sha1': (passlib.hash.sha1_crypt, {}) |
52 | 54 |
} |
53 | 55 |
|
56 |
|
|
54 | 57 |
def parse_arguments(input_args): |
55 | 58 |
usage = "usage: %prog [-h] [-m encrypt-method] <password>" |
56 | 59 |
parser = OptionParser(usage=usage) |
Also available in: Unified diff