rsa implementation question

Heiko Wundram heikowu at ceosg.de
Wed Aug 11 20:56:27 CEST 2004


Am Mittwoch, 11. August 2004 19:20 schrieb Heiko Wundram:
> def pad_for_rsa_encrypt(data,algo,n):
> 	retv = [data]
> 	strlen = len(data)
> 	nlen = log2(n)/8
> 	while strlen < nlen-3:
> 		data.append(<randomchars>)
> 		nlen -= len(<randomchars>)
> 	data.append(chr(algo))
> 	data.append(struct.pack("!H",strlen))
> 	return "".join(data)

Whoops, replace data.append by retv.append in that whole block...

Heiko.



More information about the Python-list mailing list