用于编码、解码和破解凯撒密码的python包和命令行脚本。
caesarcipher的Python项目详细描述
用于编码、解码和破解的python包和命令行脚本 带有Caesar Shift Cipher的消息。
目录
功能
- 编码
- 解码
- 破解(解码不带已知偏移量的密文)
- 任意密码偏移量
- 命令行界面
- 测试套件
- 同时支持Python2和3
- PEP8。赞美黑魔王
用法
命令行
编码消息:
$ caesarcipher --encode "This is a message I want to encode."
使用特定偏移量对消息进行编码:
$ caesarcipher --offset 14 --encode "This is a message I want to encode."
解码具有特定偏移量的密文:
$ caesarcipher --offset 14 --decode "W kobh hc sbqcrs hvwg ghfwbu."
在不知道偏移量的情况下破解密文:
$ caesarcipher --crack "W kobh hc sbqcrs hvwg ghfwbu."
库
编码消息:
>>>fromcaesarcipherimportCaesarCipher>>>cipher=CaesarCipher('I want to encode this string')>>>cipher.encoded'W kobh hc sbqcrs hvwg ghfwbu.'
使用特定偏移量对消息进行编码:
>>>fromcaesarcipherimportCaesarCipher>>>cipher=CaesarCipher('I want to encode this string.',...offset=14)>>>cipher.encoded'W kobh hc sbqcrs hvwg ghfwbu.'
解码具有特定偏移量的密文:
>>>fromcaesarcipherimportCaesarCipher>>>cipher=CaesarCipher('W kobh hc sbqcrs hvwg ghfwbu.',...offset=14)>>>cipher.decoded'I want to encode this string.'
在不知道偏移量的情况下破解密文:
>>>fromcaesarcipherimportCaesarCipher>>>cipher=CaesarCipher('W kobh hc sbqcrs hvwg ghfwbu.')>>>cipher.cracked'I want to encode this string.'
开发
黑客攻击
要破解该项目,请克隆GitHub repo:
$ git clone https://github.com/RobSpectre/Caesar-Cipher.git
然后安装在virtualenv中。
$ pip install -e ./
元
- 作者Rob Spectre
- 用于2014年伦敦黑客奥运会
- 发布于MIT License
- 软件是按原样-没有明示或暗示的保证。
- 众所周知,Caesar Shift Cipher很容易开裂,这一点可以证明 就凭这个包裹。不要混淆实际的密码或使用 任何重要的事情-对于一个阳光明媚的假期来说,这只是一道有趣的数学题 下午。