2017-06-14 10:21:31 +08:00
|
|
|
#!/usr/bin/python
|
|
|
|
|
|
|
|
import getpass
|
2017-09-10 01:53:58 +08:00
|
|
|
import src.my_scrypt
|
2017-09-10 02:21:57 +08:00
|
|
|
import binascii
|
|
|
|
import src.password_provider
|
2017-08-14 07:43:33 +08:00
|
|
|
|
2017-06-14 10:21:31 +08:00
|
|
|
password1 = getpass.getpass()
|
2017-09-10 01:53:58 +08:00
|
|
|
password2 = getpass.getpass(prompt='Repeat the same password:')
|
2017-06-14 10:21:31 +08:00
|
|
|
|
|
|
|
if password1 == password2:
|
2017-09-10 01:53:58 +08:00
|
|
|
hash = src.my_scrypt.getVerificationHash(password1)
|
2017-09-06 09:22:16 +08:00
|
|
|
|
2017-09-10 02:21:57 +08:00
|
|
|
src.password_provider.setPasswordHash(binascii.hexlify(hash))
|
|
|
|
|
|
|
|
print('Password has been generated and saved into password.txt. You can now login.')
|
2017-06-14 10:21:31 +08:00
|
|
|
else:
|
|
|
|
print('Entered passwords are not identical!')
|