Ejemplo n.º 1
0
    def _create_db(self):
        connection = sqlite3.connect(self.usersettings["dbpath"])
        cursor = connection.cursor()
        cursor.execute(self._load_sql("create_account_table.sql"))
        cursor.execute(self._load_sql("create_user_table.sql"))
        cursor.execute(self._load_sql("create_poolcerts_table.sql"))

        _new_name = input("Enter New Username: "******"Enter New Password (min 8 chars incl number + specialchars): ")

        if verify_password(_new_pwd) is False:
            print("PASSWORD TO WEAK")
            sys.exit(2)

        _new_pwd = hash256(_new_pwd)

        cursor.execute(self._load_sql("insert_user.sql"),
                       (_new_pwd, _new_name, mk_timestamp()))
        connection.commit()
Ejemplo n.º 2
0
import sys
sys.path.append(".")

from casper.utils import hash256, to_base32, to_hex
from casper.fernet import FernetCipher

F = FernetCipher("test-password1234")

ENCRYPTED = F.encrypt("message")
DECRYPTED = F.decrypt(ENCRYPTED)

print(ENCRYPTED, DECRYPTED)
print(to_hex(to_base32(hash256(ENCRYPTED))))