I'm writing a "RSA Encyrpter && Decrypter" in python.
I got two files: "public.txt" and "private.txt", each of them consists of two lines with key pairs, for instance:
private.txt:
551
437
public.txt:
23
437
I want to read those lines from file and I'm doing this by using "readlines()" in python, please have a look:
def load_keys():
n = open("private.txt", "r").readlines()[1].strip()
e = open("private.txt", "r").readlines()[0].strip()
d = open("public.txt", "r").readlines()[0].strip()
However, n, e, d
are safed as string.. I'm trying to convert it to digit and for small numbers it's fine - I can use int() or long() but what if I want to use a number like 2972707374889996847812667774394680002419656866566098604400031599302998562192384595754389927039245776685876687343128498677629624892701967351358081915610133
?
How to read that number from a file and save as digit without limit?
自PEP 237 https://www.python.org/dev/peps/pep-0237/起,Python可以将其作为int来处理。
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.