diff options
author | Sylvain Munaut <tnt@246tNt.com> | 2010-12-06 20:07:22 +0100 |
---|---|---|
committer | Sylvain Munaut <tnt@246tNt.com> | 2010-12-06 20:07:22 +0100 |
commit | be17997e55cb5544d3cc74c981b4d605b9e0a7dc (patch) | |
tree | bc43fef50cd76b9eaa0b353ef73360ee56133992 | |
parent | 6576ce18868baab6aca98d0d23997228c389a791 (diff) |
Add a internal h2i purely for symmetry :)
Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
-rwxr-xr-x | pySim.py | 6 |
1 files changed, 4 insertions, 2 deletions
@@ -31,7 +31,6 @@ import sys from smartcard.Exceptions import NoCardException from smartcard.System import readers from smartcard.CardConnectionObserver import ConsoleCardConnectionObserver -from smartcard.util import toBytes # ---------------------------------------------------------------------------- @@ -44,6 +43,9 @@ def h2b(s): def b2h(s): return ''.join(['%02x'%ord(x) for x in s]) +def h2i(s): + return [(int(x,16)<<4)+int(y,16) for x,y in zip(s[0::2], s[1::2])] + def i2h(s): return ''.join(['%02x'%(x) for x in s]) @@ -307,7 +309,7 @@ class PcscSimLink(object): data : string (in hex) of returned data (ex. "074F4EFFFF") sw : string (in hex) of status word (ex. "9000") """ - apdu = toBytes(pdu) + apdu = h2i(pdu) data, sw1, sw2 = self._con.transmit(apdu) |