小编moh*_*ily的帖子

如何在python中顺序更改字符串?

我正在尝试为DES上的暴力攻击编写一个程序,键是一个由8位字符组成的字符串,例如(12345678).

所以我需要一些帮助来编写一个程序,我可以将测试键设置为(00000000)并开始逐步循环(00000001),(00000002)直到(99999999)并且每次尝试按键.

我已经完成了DES程序,现在我的大脑仍然坚持这部分.

更新:非常感谢Hyperboreus,关键生成器功能,但是当我在我的程序中使用它时,我收到错误消息

UnicodeDecodeError:'utf-8'编解码器无法解码位置1中的字节0xbf:无效的起始字节

任何大于(00000002)的密钥

这是我的代码

from Crypto.Cipher import DES 
import os 
import base64

print ("key size is fixed at 16 Bytes including parities (56 bits effective)")
size = 16

key = '00000002'
cipher = DES.new(key)            
BS = 8


def getMode():
    while True:
        mode = input('Do you wish to Encrypt "e", Decrypt "d" or Brute force "b" a message?\n')
        if mode in 'e d b'.split():
            return mode
        else:
            print('Enter either "e" for encrypt,"d" for decrypt, or "b" …
Run Code Online (Sandbox Code Playgroud)

python string des generator sequence

1
推荐指数
1
解决办法
229
查看次数

标签 统计

des ×1

generator ×1

python ×1

sequence ×1

string ×1