Coverage for /pythoncovmergedfiles/medio/medio/usr/local/lib/python3.8/site-packages/cryptography/hazmat/primitives/constant_time.py: 40%

5 statements  

« prev     ^ index     » next       coverage.py v7.0.1, created at 2022-12-25 06:11 +0000

1# This file is dual licensed under the terms of the Apache License, Version 

2# 2.0, and the BSD License. See the LICENSE file in the root of this repository 

3# for complete details. 

4 

5 

6import hmac 

7 

8 

9def bytes_eq(a: bytes, b: bytes) -> bool: 

10 if not isinstance(a, bytes) or not isinstance(b, bytes): 

11 raise TypeError("a and b must be bytes.") 

12 

13 return hmac.compare_digest(a, b)