小编Hua*_*eng的帖子

GitHub Search API仅返回30个结果

https://api.github.com/search/issues?q=stress+test+label:bug+language:python+state:closed

上面的查询假设返回76个结果,当我尝试运行它时,它只返回30.我猜GitHub会在超过30时返回结果.任何想法我怎么能得到其余的结果?

github-api

11
推荐指数
2
解决办法
5822
查看次数

Python Crypto,RSA公钥/私钥,包含大文件

我现在知道RSA公钥/私钥只能一次加密非常短的输入,但任何人都可以提供一种方法来加密任何类型的文件(.txt,.phf,.exe等)只有公钥/私钥?我不想要额外的AES密钥.

这是我的代码,在使用公钥和私钥对进行加密和解密后,我没有收到原始内容.我不关心加密或解密的安全性,我只想让简单的加密解密工作在它可能需要的任何输入上,无论它有多长或多大.

from Crypto.PublicKey import RSA
from Crypto import Random


random_generator = Random.new().read
key = RSA.generate(1024, random_generator)
public_key = key.publickey()

f = open('C:\Users\Administrator\Desktop\jack.txt','r').read()

print 'original content: '+ f

enc_data = public_key.encrypt(f, 32)
print 'encrypted data: '
print enc_data

dec_data = key.decrypt(enc_data)
print 'decrypted data: '+ dec_data
Run Code Online (Sandbox Code Playgroud)

这是输出:

original content: Python Cryptography Toolkit

A collection of cryptographic modules implementing various algorithms and protocols.

Subpackages:

Crypto.Cipher
Secret-key (AES, DES, ARC4) and public-key encryption (RSA PKCS#1) algorithms
Crypto.Hash
Hashing algorithms (MD5, SHA, HMAC) …
Run Code Online (Sandbox Code Playgroud)

python encryption cryptography rsa pycrypto

3
推荐指数
2
解决办法
2万
查看次数

标签 统计

cryptography ×1

encryption ×1

github-api ×1

pycrypto ×1

python ×1

rsa ×1