用于编码、解码和破解凯撒密码的python包和命令行脚本。

caesarcipher的Python项目详细描述


用于编码、解码和破解的python包和命令行脚本 带有Caesar Shift Cipher的消息。

https://travis-ci.org/RobSpectre/Caesar-Cipher.svg?branch=masterhttps://coveralls.io/repos/RobSpectre/Caesar-Cipher/badge.png?branch=master

目录

功能

  • 编码
  • 解码
  • 破解(解码不带已知偏移量的密文)
  • 任意密码偏移量
  • 命令行界面
  • 测试套件
  • 同时支持Python2和3
  • PEP8。赞美黑魔王

安装

最新版本可以通过pip安装。

$ pip install caesarcipher

如果不起作用,请尝试easy_installa:

$ easy_install caesarcipher

用法

命令行

编码消息:

$ 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 ./

测试

该项目使用Nose进行测试。只需从项目根目录运行。

$ nosetests -v

你去看看保险和PEP8吧!

$ nosetests -v --with-coverage --with-tissue

  • 作者Rob Spectre
  • 用于2014年伦敦黑客奥运会
  • 发布于MIT License
  • 软件是按原样-没有明示或暗示的保证。
  • 众所周知,Caesar Shift Cipher很容易开裂,这一点可以证明 就凭这个包裹。不要混淆实际的密码或使用 任何重要的事情-对于一个阳光明媚的假期来说,这只是一道有趣的数学题 下午。

欢迎加入QQ群-->: 979659372 Python中文网_新手群

推荐PyPI第三方库


热门话题
在Java中从本地文件系统导入文件   spring boot如何在Java SpringBoot项目中集成Olingo(Odata)   java查找连续数组中缺少的第k个元素(超过时间限制)   java为什么在mySql中插入1/2行时会得到2/4行   java不能在静态上下文中使用它   File Observer方法的java My onEvent()部分不起作用   java Netty NioSocketChannel在多线程写入时收到中断消息   java将文件夹与父文件夹一起复制   java我的TictaToe代码出了什么问题?如何检查已采取的措施?   java Swing JTable更新   java如何将cordinates查找为int   如何使用selenium和java在firefox中打开新的空选项卡   java Gradle构建输出Jar未运行   java没有GET/WEBINF/jsp/login的映射。jsp