This is merely a historical archive of years 2008-2021, before the migration to mailman3.
A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.
Ludovic Rousseau gerrit-no-reply at lists.osmocom.orgLudovic Rousseau has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-sim-auth/+/20906 )
Change subject: utils: add byteToHex() function
......................................................................
utils: add byteToHex() function
equivalent to pyscard "toHexString"
byteToHex([121, 150, 252, 108]) -> "5F638756"
Change-Id: Ia1a0db131f5823f6096b298461fdb00e049eef03
---
M card/utils.py
1 file changed, 10 insertions(+), 1 deletion(-)
git pull ssh://gerrit.osmocom.org:29418/osmo-sim-auth refs/changes/06/20906/1
diff --git a/card/utils.py b/card/utils.py
index e3777d7..9a04dcf 100644
--- a/card/utils.py
+++ b/card/utils.py
@@ -23,7 +23,7 @@
#################################
from collections import deque
-from smartcard.util import toBytes
+from smartcard.util import toBytes, toHexString, PACK
import sys
# from python 2.6, format('b') allows to use 0b10010110 notation:
@@ -70,6 +70,15 @@
string += chr(b)
return string
+# equivalent to pyscard "toHexString"
+def byteToHex(bytelist):
+ '''
+ byteToHex([121, 150, 252, 108]) -> "5F638756"
+
+ converts a list of bytes into a string of hex
+ '''
+ return toHexString(bytelist, format=PACK)
+
def LV_parser(bytelist):
'''
LV_parser([0x02, 0xAB, 0xCD, 0x01, 0x12, 0x34]) -> [[171, 205], [18], []]
--
To view, visit https://gerrit.osmocom.org/c/osmo-sim-auth/+/20906
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Project: osmo-sim-auth
Gerrit-Branch: master
Gerrit-Change-Id: Ia1a0db131f5823f6096b298461fdb00e049eef03
Gerrit-Change-Number: 20906
Gerrit-PatchSet: 1
Gerrit-Owner: Ludovic Rousseau <ludovic.rousseau+osmocom at free.fr>
Gerrit-MessageType: newchange
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20201025/38eb5fd1/attachment.htm>