import hashlib
import os

def hashPassword(password: str) -> str:
    salt = os.urandom(16)
    hashed = hashlib.sha256(salt + password.encode()).hexdigest()
    return salt.hex() + ":" + hashed


def verifyPassword(password: str, stored: str) -> bool:
    salt, stored_hash = stored.split(":")
    salt = bytes.fromhex(salt)
    calc_hash = hashlib.sha256(salt + password.encode()).hexdigest()
    return calc_hash == stored_hash

