用于编码、解码和破解凯撒密码的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在循环中使用if语句   Java onthefly字符串替换   安卓 java。util。拉链ZipInputStream在解压过程中部分为空   java检查安卓设备是否支持4K视频?   java如何显示ArrayList<Integer[]>lista=new ArrayList<>()   如何在Java8中将字符流转换为字符串   java序列化ArrayList<Objects>并返回,保留类   java通过复制到webapps手动部署Tomcat应用   java如何将JsonNode转换为映射   java从addOnSuccessListener获取结果   java在泛型类中生成随机数   列表中每个对象的java格式   最新GAE SDK版本(1.9.26)的java MemcacheService增量问题   RESTful服务的java url设计   java Maven可传递依赖公共集合版本3 vs 4   list Java:如何使用try/catch块和return   如何在Eclipse 202012中为Java 14启用预览功能?