eric6/WebBrowser/SafeBrowsing/SafeBrowsingUtilities.py

changeset 6942
2602857055c5
parent 6645
ad476851d7e0
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/eric6/WebBrowser/SafeBrowsing/SafeBrowsingUtilities.py	Sun Apr 14 15:09:21 2019 +0200
@@ -0,0 +1,35 @@
+# -*- coding: utf-8 -*-
+
+# Copyright (c) 2017 - 2019 Detlev Offenbach <detlev@die-offenbachs.de>
+#
+
+"""
+Module implementing some utilities for Google Safe Browsing.
+"""
+
+from __future__ import unicode_literals
+
+import sys
+
+if sys.version_info < (3, 0):
+    def toHex(value):
+        """
+        Public method to convert a bytes array to a hex string.
+        
+        @param value value to be converted
+        @type bytes
+        @return hex string
+        @rtype str
+        """
+        return value.encode("hex")
+else:
+    def toHex(value):
+        """
+        Public method to convert a bytes array to a hex string.
+        
+        @param value value to be converted
+        @type bytes
+        @return hex string
+        @rtype str
+        """
+        return value.hex()

eric ide

mercurial