Exemplo n.º 1
0
def test_lricb_enc():
    key = binascii.unhexlify("E0C4935FF0C254CD2CEF8FDDC32460CF")
    pt = binascii.unhexlify("012D7F1653CAF6503C6AB0C1010E8CB0")

    lrp = LRP(key, 0, b"\xC3\x31\x5D\xBF", pad=True)
    ct = lrp.encrypt(pt)
    assert ct.hex().upper(
    ) == "FCBBACAA4F29182464F99DE41085266F480E863E487BAAF687B43ED1ECE0D623"
Exemplo n.º 2
0
def execute_test_vec(KEY, IV, USEPADDING, PT, CT):
    KEY = binascii.unhexlify(KEY)
    USEPADDING = not not USEPADDING
    PT = binascii.unhexlify(PT)
    CT = binascii.unhexlify(CT)
    IV = binascii.unhexlify(IV)

    lrp = LRP(KEY, 0, IV, USEPADDING)
    assert lrp.encrypt(PT).hex().upper() == CT.hex().upper()
    lrp = LRP(KEY, 0, IV, USEPADDING)
    assert lrp.decrypt(CT).hex().upper() == PT.hex().upper()