Python 伪密钥滤波器
是否有任何可能的方法来过滤加密系统中的密钥空间,以获得一组密钥,从而解密出有效文本(使用相同语言或可读的文本) 我尝试了一种随机的方法,得到了一组特定的键,但对于实际需要的文本大小来说,这并不是一种欣赏 代码Python 伪密钥滤波器,python,algorithm,encryption,cryptography,pycrypto,Python,Algorithm,Encryption,Cryptography,Pycrypto,是否有任何可能的方法来过滤加密系统中的密钥空间,以获得一组密钥,从而解密出有效文本(使用相同语言或可读的文本) 我尝试了一种随机的方法,得到了一组特定的键,但对于实际需要的文本大小来说,这并不是一种欣赏 代码 from Crypto.Cipher import ARC4 import base64, string, time, random key = ''.join(random.choice(string.ascii_letters + string.digits ) for i in
from Crypto.Cipher import ARC4
import base64, string, time, random
key = ''.join(random.choice(string.ascii_letters + string.digits ) for i in range(8))
obj1 = ARC4.new(key)
obj2 = ARC4.new(key)
text = 'abcdefgh'
cipher_text = base64.b64encode(obj1.encrypt(text))
decoded_text= obj2.decrypt(base64.b64decode(cipher_text))
Dict={}
count=0
valid = set(string.ascii_letters + string.digits )
def test(s):
return set(s).issubset(valid)
print; print 'plain text: ', text
print; print 'Actual key: ', key
print; print 'Cipher text: ', cipher_text
timeout=time.time()+60
while time.time()< timeout:
count+=1
key = ''.join(random.choice(string.ascii_letters + string.digits ) for i in range(8))
obj2 = ARC4.new(key)
decoded= obj2.decrypt(base64.b64decode(cipher_text))
if test(decoded):
Dict.update({'key: '+key : 'Valid Decrypted Text: '+decoded})
import pprint
print; print 'Analysis: '
pprint.pprint(Dict)
print;print 'Number of valid Decrypted Text: ', len(Dict)
print;print 'Total number of decryption performed: ', count
有没有更好的办法来整理这些钥匙这些密钥可能有助于通过引入混淆来加强加密它们似乎已经造成了很多混淆。一个好的密码不需要“混淆”。最好先问一下,因为这个问题实际上与编程无关,您想知道如何造成这种混乱。但是要小心,你可能想穿厚皮的衣服:)。我认为密码学的复杂性是对处理能力的挑战。是的,但如果没有这些特殊密钥,它已经很复杂了。
plain text: abcdefgh
Actual key: go6oMkCG
Cipher text: JB1a3osG+es=
Analysis:
{'key: 0UUvjzLw': 'Valid Decrypted Text: mzptBVo4',
'key: 2beOXKN1': 'Valid Decrypted Text: Yhz3jIL8',
'key: 3Eq7MKwu': 'Valid Decrypted Text: GA9BTdzy',
'key: 3jUQPXs8': 'Valid Decrypted Text: 3gCa3KBG',
.
.
Number of valid Decrypted Text: 36
Total number of decryption performed: 2275140