Esempio n. 1
0
def test_reset(context):
    h = hmaccontext.HMACContext(algo='hmac_sha256')
    h.key = b'This is a key'
    h.write('yadayada')
    one = h.read()
    h.reset()
    h.write('yadayada')
    assert one == h.read()
Esempio n. 2
0
def test_init(context):
    h = hmaccontext.HMACContext(algo='hmac_sha256')
    assert h.secure == True
Esempio n. 3
0
def test_verify(context):
    h = hmaccontext.HMACContext(algo='hmac_sha256')
    h.key = b'This is a key'
    h.write('Yiah, data \o/')
    assert h.verify(b'W\xc3\xa9yD\xb70\xfa\xef\x8f\xc6\xd4v\xc9\x8a\xe8|9\xed-\xca\x06\xa2\xb7W\xb1\xa7o %4@') == True
Esempio n. 4
0
def test_write(context):
    h = hmaccontext.HMACContext(algo='hmac_sha256')
    h.key = b'This is a key'
    h.write('Yiah, data \o/')
Esempio n. 5
0
def test_get(context):
    h = hmaccontext.HMACContext(algo='hmac_sha256')
    assert h.maclen == 32
    assert h.keylen == 64
Esempio n. 6
0
def test_set(context):
    h = hmaccontext.HMACContext(algo='gmac_serpent')
    h.key = b'This is a key'
    h.iv = 'This is an IV'