<p>Ludovic Rousseau has uploaded this change for <strong>review</strong>.</p><p><a href="https://gerrit.osmocom.org/c/osmo-sim-auth/+/20906">View Change</a></p><pre style="font-family: monospace,monospace; white-space: pre-wrap;">utils: add byteToHex() function<br><br>equivalent to pyscard "toHexString"<br>byteToHex([121, 150, 252, 108]) -> "5F638756"<br><br>Change-Id: Ia1a0db131f5823f6096b298461fdb00e049eef03<br>---<br>M card/utils.py<br>1 file changed, 10 insertions(+), 1 deletion(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">git pull ssh://gerrit.osmocom.org:29418/osmo-sim-auth refs/changes/06/20906/1</pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;"><span>diff --git a/card/utils.py b/card/utils.py</span><br><span>index e3777d7..9a04dcf 100644</span><br><span>--- a/card/utils.py</span><br><span>+++ b/card/utils.py</span><br><span>@@ -23,7 +23,7 @@</span><br><span> #################################</span><br><span> </span><br><span> from collections import deque</span><br><span style="color: hsl(0, 100%, 40%);">-from smartcard.util import toBytes</span><br><span style="color: hsl(120, 100%, 40%);">+from smartcard.util import toBytes, toHexString, PACK</span><br><span> import sys</span><br><span> </span><br><span> # from python 2.6, format('b') allows to use 0b10010110 notation: </span><br><span>@@ -70,6 +70,15 @@</span><br><span>         string += chr(b)</span><br><span>     return string</span><br><span> </span><br><span style="color: hsl(120, 100%, 40%);">+# equivalent to pyscard "toHexString"</span><br><span style="color: hsl(120, 100%, 40%);">+def byteToHex(bytelist):</span><br><span style="color: hsl(120, 100%, 40%);">+    '''</span><br><span style="color: hsl(120, 100%, 40%);">+    byteToHex([121, 150, 252, 108]) -> "5F638756"</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+    converts a list of bytes into a string of hex</span><br><span style="color: hsl(120, 100%, 40%);">+    '''</span><br><span style="color: hsl(120, 100%, 40%);">+    return toHexString(bytelist, format=PACK)</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span> def LV_parser(bytelist):</span><br><span>     '''</span><br><span>     LV_parser([0x02, 0xAB, 0xCD, 0x01, 0x12, 0x34]) -> [[171, 205], [18], []]</span><br><span></span><br></pre><p>To view, visit <a href="https://gerrit.osmocom.org/c/osmo-sim-auth/+/20906">change 20906</a>. To unsubscribe, or for help writing mail filters, visit <a href="https://gerrit.osmocom.org/settings">settings</a>.</p><div itemscope itemtype="http://schema.org/EmailMessage"><div itemscope itemprop="action" itemtype="http://schema.org/ViewAction"><link itemprop="url" href="https://gerrit.osmocom.org/c/osmo-sim-auth/+/20906"/><meta itemprop="name" content="View Change"/></div></div>

<div style="display:none"> Gerrit-Project: osmo-sim-auth </div>
<div style="display:none"> Gerrit-Branch: master </div>
<div style="display:none"> Gerrit-Change-Id: Ia1a0db131f5823f6096b298461fdb00e049eef03 </div>
<div style="display:none"> Gerrit-Change-Number: 20906 </div>
<div style="display:none"> Gerrit-PatchSet: 1 </div>
<div style="display:none"> Gerrit-Owner: Ludovic Rousseau <ludovic.rousseau+osmocom@free.fr> </div>
<div style="display:none"> Gerrit-MessageType: newchange </div>