1 # -*- coding: utf-8 -*- |
|
2 |
|
3 # Copyright (c) 2017 - 2019 Detlev Offenbach <detlev@die-offenbachs.de> |
|
4 # |
|
5 |
|
6 """ |
|
7 Module implementing some utilities for Google Safe Browsing. |
|
8 """ |
|
9 |
|
10 from __future__ import unicode_literals |
|
11 |
|
12 import sys |
|
13 |
|
14 if sys.version_info < (3, 0): |
|
15 def toHex(value): |
|
16 """ |
|
17 Public method to convert a bytes array to a hex string. |
|
18 |
|
19 @param value value to be converted |
|
20 @type bytes |
|
21 @return hex string |
|
22 @rtype str |
|
23 """ |
|
24 return value.encode("hex") |
|
25 else: |
|
26 def toHex(value): |
|
27 """ |
|
28 Public method to convert a bytes array to a hex string. |
|
29 |
|
30 @param value value to be converted |
|
31 @type bytes |
|
32 @return hex string |
|
33 @rtype str |
|
34 """ |
|
35 return value.hex() |
|