Followup to r347996
Replace uses of `foo.encode("hex")` with `binascii.hexlify(foo)` for forwards compatibility between python 2.x and python 3. PR: 237403 MFC after: 1 week
This commit is contained in:
parent
04e0c883c5
commit
e8b4bbdfae
@ -262,7 +262,7 @@ def runCCMEncrypt(self, fname):
|
||||
out = r + tag
|
||||
self.assertEqual(out, ct,
|
||||
"Count " + data['Count'] + " Actual: " + \
|
||||
repr(out.encode("hex")) + " Expected: " + \
|
||||
repr(binascii.hexlify(out)) + " Expected: " + \
|
||||
repr(data) + " on " + cname)
|
||||
|
||||
def runCCMDecrypt(self, fname):
|
||||
@ -313,7 +313,7 @@ def runCCMDecrypt(self, fname):
|
||||
payload = payload[:plen]
|
||||
self.assertEqual(r, payload,
|
||||
"Count " + data['Count'] + \
|
||||
" Actual: " + repr(r.encode("hex")) + \
|
||||
" Actual: " + repr(binascii.hexlify(r)) + \
|
||||
" Expected: " + repr(data) + \
|
||||
" on " + cname)
|
||||
|
||||
@ -405,7 +405,7 @@ def runSHA(self, fname):
|
||||
_, r = c.encrypt(msg, iv="")
|
||||
|
||||
self.assertEqual(r, md, "Actual: " + \
|
||||
repr(r.encode("hex")) + " Expected: " + repr(data) + " on " + cname)
|
||||
repr(binascii.hexlify(r)) + " Expected: " + repr(data) + " on " + cname)
|
||||
|
||||
@unittest.skipIf(cname not in shamodules, 'skipping SHA-HMAC on %s' % str(cname))
|
||||
def test_sha1hmac(self):
|
||||
@ -462,7 +462,7 @@ def runSHA1HMAC(self, fname):
|
||||
_, r = c.encrypt(msg, iv="")
|
||||
|
||||
self.assertEqual(r[:tlen], mac, "Actual: " + \
|
||||
repr(r.encode("hex")) + " Expected: " + repr(data))
|
||||
repr(binascii.hexlify(r)) + " Expected: " + repr(data))
|
||||
|
||||
return GendCryptoTestCase
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user