# читаем файл file = open(sys.argv[2], "r") text = file.read() file.close() # сгенерируем хеш hash_text = "".join([str(hex(h)[2:]).replace("L", "") for h in SHA1.sha1(text)]) # хеш шифруем закрытым ключом file = open(sys.argv[4], "r") buf = file.readline() d = int(buf) buf = file.readline() n = int(buf) file.close() crypted_hash = RSA.encryptstr(d, n, hash_text) # дешифруем с помощью открытого ключа file = open(sys.argv[3], "r") buf = file.readline() e = int(buf) decrypted_hash = "".join([chr(i) for i in RSA.decryptlist(e, n, crypted_hash)]) file.close() # сраниваем подписи if hash_text == decrypted_hash: print("Succesfull validate!") else: print("Digital signatures do not match!") if sys.argv[1] == "genkey_rsa":