[PATCH 0/1] pysim: make random seed function python3 compatible

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/OpenBSC@lists.osmocom.org/.

Jeremy Herbert jeremy.006 at gmail.com
Sun Oct 25 10:56:04 UTC 2020


Currently the random seed function _digits is not python3 compatible as it passes a unicode string to the sha1 function. It generates the following exception:


Using PC/SC reader interface

Card programming failed with an execption:
---------------------8<---------------------
Traceback (most recent call last):
  File "./pySim-prog.py", line 718, in <module>
    rc = process_card(opts, first, card_handler)
  File "./pySim-prog.py", line 643, in process_card
    cp = gen_parameters(opts)
  File "./pySim-prog.py", line 342, in gen_parameters
    iccid += _digits(opts.secret, 'ccid', ml, opts.num)
  File "./pySim-prog.py", line 228, in _digits
    s = hashlib.sha1(secret + usage + '%d' % num)
TypeError: Unicode-objects must be encoded before hashing
---------------------8<---------------------


This patch fixes this problem.


Jeremy Herbert (1):
  make random seed function python3 compatible

 pySim-prog.py | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

-- 
2.25.1




More information about the OpenBSC mailing list