Change in pysim[master]: Import function for converting bytes list in (hex or int) to string f...

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/.

herlesupreeth gerrit-no-reply at lists.osmocom.org
Mon May 11 07:57:27 UTC 2020


herlesupreeth has uploaded this change for review. ( https://gerrit.osmocom.org/c/pysim/+/18195 )


Change subject: Import function for converting bytes list in (hex or int) to string from https://github.com/mitshell/card
......................................................................

Import function for converting bytes list in (hex or int) to string from https://github.com/mitshell/card

This function is needed for conversion of bytes list output of TLV parser to representable string.
This function is imported from the git commit 2a81963790e27eb6b188359af169c45afb6d3aaf of master branch

Change-Id: I8c1e39ccf9fb517d465e73f69c720e7fdde02ded
---
M pySim/utils.py
1 file changed, 17 insertions(+), 0 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/pysim refs/changes/95/18195/1

diff --git a/pySim/utils.py b/pySim/utils.py
index eb7a56b..48af020 100644
--- a/pySim/utils.py
+++ b/pySim/utils.py
@@ -398,3 +398,20 @@
 		else:
 			bytelist = bytelist[ L+2 : ]
 	return ret
+
+# equivalent to the pyscard function "toASCIIString"
+def byteToString(bytelist):
+	'''
+	byteToString([116, 101, 115, 116]) -> 'test'
+
+	converts a list of bytes into a string
+	'''
+	import sys
+
+	if sys.version_info[0] < 3:
+		string = ''
+		for b in bytelist:
+			string += chr(b)
+		return string
+	else:
+		return bytes(bytelist)

-- 
To view, visit https://gerrit.osmocom.org/c/pysim/+/18195
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: pysim
Gerrit-Branch: master
Gerrit-Change-Id: I8c1e39ccf9fb517d465e73f69c720e7fdde02ded
Gerrit-Change-Number: 18195
Gerrit-PatchSet: 1
Gerrit-Owner: herlesupreeth <herlesupreeth at gmail.com>
Gerrit-MessageType: newchange
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20200511/91062306/attachment.htm>


More information about the gerrit-log mailing list