(masterkey, seed1, seed2, rounds)
return sha_obj.digest()
This method creates the key to decrypt the database
This method creates the key to decrypt the database
This method creates the key to decrypt the database
def transform_key(masterkey, seed1, seed2, rounds):
    """This method creates the key to decrypt the database"""

    if masterkey is None or seed1 is None or seed2 is None or rounds is None:
        raise TypeError('None type not allowed')
    aes = AES.new(seed1, AES.MODE_ECB)

    # Encrypt the created hash
    for i in range(rounds):
        masterkey = aes.encrypt(masterkey)

    # Finally, hash it again...
    sha_obj = SHA256.new()
    sha_obj.update(masterkey)
    masterkey = sha_obj.digest()
    # ...and hash the result together with the randomseed
    sha_obj = SHA256.new()
    sha_obj.update(seed2 + masterkey)
    return sha_obj.digest()
def transform_key ( masterkey , seed1 , seed2 , rounds ) : if masterkey is None or seed1 is None or seed2 is None or rounds is None : raise TypeError ( 'None type not allowed' ) aes = AES . new ( seed1 , AES . MODE_ECB ) # Encrypt the created hash for i in range ( rounds ) : masterkey = aes . encrypt ( masterkey ) # Finally, hash it again... sha_obj = SHA256 . new ( ) sha_obj . update ( masterkey ) masterkey = sha_obj . digest ( ) # ...and hash the result together with the randomseed sha_obj = SHA256 . new ( ) sha_obj . update ( seed2 + masterkey ) return sha_obj . digest ( )