Git Product home page Git Product logo

cypher's Introduction

Cypher:

Implementation of Caesar and Vigenère ciphers

  • A Caesar cipher takes a numerical value between 1-25 inclusive and shifts each character by that amount and returns an encrypted message. You can decrypt the same message by unshifting by the same amount only if you know the shift value. Even if you don't, you can try all 25 combinations of shift values till you get a message that looks like English.

  • A Vigenère cipher is an improved version of the Caesar cipher, where the shift values are not constant but derived from the position values of letters of a secret key in the alphabet. This makes it more difficult computationally to crack a Vigenère cipher if you don't know what keys were used. But you can still crack it nonetheless. If you know the key's length, you can brute force this approach. If you don't you can look at the cipher text and look for repeating patterns, as usually English messages have a lot of repeating words. If you find a pattern such as WQL twice in a sentence, you can estimate that the key's length might be 3. Another step is frequency analysis where you can exploit the uneven distribution of letters in the language. The letter E is the most common letter in the English language so if your cipher text has a lot of X's, chances are that X corresponds to E. Using a combination of these techniques and enough computational power, one may easily crack a Vigenère cipher.

Usage

On a successful run, with default values, you should see only the Vigenère function output. You can pass in your own data and key to use in the Vigenère cipher. cargo run -- --key <your key> <data to encrypt>. Key and Data are both optional, the defaults will be used if not provided. Checking is done using assertion macros so you need not pinch your eyeballs to check each character for correct decryption.

Options

  • -k/--key : Provide your own Vigenère key
  • -t/--trace: Turn on rust stacktracing

cypher's People

Contributors

weezy20 avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.