def gen_pass(dump, key):
"""Generate password for a user account."""
if key is None:
print("no key available")
exit(1)
rands = ''.join(random.choice(CHARS) for _ in range(64))
encoded = wrapper.encrypt(rands, key)
raw = wrapper.decrypt(encoded, key)
if rands != raw:
print("encrypt/decrypt problem")
exit(1)
if dump:
print("password:")
print(raw)
print("config file encoded")
print(encoded)
else:
return (raw, encoded)
评论列表
文章目录