Example #1
0
def verify_signature(secret, salt, msg, signature):
    plaintext, spaces_added = qcrypt._appendSpaces(msg)
    aes = AES.new(saltedhash_bin(secret, salt), AES.MODE_CBC)
    ciphertext = aes.encrypt(plaintext)
    new_signature = hash_hex(ciphertext)
    return bool(new_signature == signature)
Example #2
0
def sign_msg(secret_hash_normalized, msg):
    plaintext, spaces_added = qcrypt._appendSpaces(msg)
    aes = AES.new(qcrypt.denormalize(secret_hash_normalized), AES.MODE_CBC)
    ciphertext = aes.encrypt(plaintext)
    signature = hash_hex(ciphertext)
    return signature