| Message ID | 20201025105605.5692-1-jeremy.006@gmail.com |
|---|---|
| Headers | show |
| Series | pysim: make random seed function python3 compatible | expand |
Hi Jeremy,
On Sun, Oct 25, 2020 at 08:56:04PM +1000, Jeremy Herbert wrote:
> 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:
thanks for your patch. I've pushed it into our gerrit, see
https://gerrit.osmocom.org/c/pysim/+/20922
Regards,
Harald
Hi Harald, Thank you. Sorry, I looked but I must have missed the gerrit for this project. Thanks, Jeremy On Tue, 27 Oct 2020 at 04:00, Harald Welte <laforge@osmocom.org> wrote: > Hi Jeremy, > > On Sun, Oct 25, 2020 at 08:56:04PM +1000, Jeremy Herbert wrote: > > 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: > > thanks for your patch. I've pushed it into our gerrit, see > https://gerrit.osmocom.org/c/pysim/+/20922 > > Regards, > Harald > -- > - Harald Welte <laforge@osmocom.org> > http://laforge.gnumonks.org/ > > ============================================================================ > "Privacy in residential applications is a desirable marketing option." > (ETSI EN 300 175-7 Ch. > A6) >
On Tue, Oct 27, 2020 at 08:41:34AM +1000, Jeremy Herbert wrote: > Thank you. Sorry, I looked but I must have missed the gerrit for this > project. no worries. I don't mind pushing some patches from e-mail to gerrit. Using gerrit is mostly important if you want to contribute more regularly (which you and anyone else is obviously very much invited to!) Regards, Harald
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(-)