From eb06b45d0edd7843551e78da468a4d907f906993 Mon Sep 17 00:00:00 2001 From: Vadim Yanitskiy Date: Sun, 10 May 2020 02:32:46 +0700 Subject: utils: fix list comprehension in h2s(): ignore upper case padding By definition, h2s() is supposed to skip padding in the given hexstring, so it was working fine for 'ff', but not for 'FF'. Change-Id: I2c5d72a0f7f2796115116737f9f7b5299021f6a3 Signed-off-by: Vadim Yanitskiy --- pySim/utils.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pySim/utils.py b/pySim/utils.py index 2de6856..20eb5a8 100644 --- a/pySim/utils.py +++ b/pySim/utils.py @@ -35,7 +35,8 @@ def i2h(s): return ''.join(['%02x'%(x) for x in s]) def h2s(s): - return ''.join([chr((int(x,16)<<4)+int(y,16)) for x,y in zip(s[0::2], s[1::2]) if not (x == 'f' and y == 'f') ]) + return ''.join([chr((int(x,16)<<4)+int(y,16)) for x,y in zip(s[0::2], s[1::2]) + if int(x + y, 16) != 0xff]) def s2h(s): return b2h(s) -- cgit v1.2.3