aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSupreeth Herle <herlesupreeth@gmail.com>2020-03-24 12:23:51 +0100
committerlaforge <laforge@osmocom.org>2020-09-20 09:49:22 +0000
commitf3948535331943df6eb7d915a64a625ed984999a (patch)
tree324654730484a42fd5cadbf23d7ebf1430b37566
parentd84daa12c2da2e830e3aafa1dc8da1f5eb90ea63 (diff)
utils.py: Add helper method to convert a hex string into array of N bytes string elements
-rw-r--r--pySim/utils.py3
1 files changed, 3 insertions, 0 deletions
diff --git a/pySim/utils.py b/pySim/utils.py
index d0d6cb5..e5434a5 100644
--- a/pySim/utils.py
+++ b/pySim/utils.py
@@ -128,6 +128,9 @@ def hexstr_to_fivebytearr(s):
def hexstr_to_threebytearr(s):
return [s[i:i+6] for i in range(0, len(s), 6) ]
+def hexstr_to_Nbytearr(s, nbytes):
+ return [s[i:i+(nbytes*2)] for i in range(0, len(s), (nbytes*2)) ]
+
# Accepts hex string representing three bytes
def dec_mcc_from_plmn(plmn):
ia = h2i(plmn)