Giter VIP home page Giter VIP logo

playfair-cipher's Introduction

Playfair Cipher

1 – We first take the Playfair key from the user and generate the grid

2 – Then we let the user choose encrypt/decrypt

3 – The user then enters either The Cipher text or The Plain Text

4 – We Then run the algorithms and produce the output

The Algorithms: Initial Setup: 1 - We start by setting up the grid of 5x5 using The Playfair Key

Encrypt:

1 - We start by remove spaces from the plain text.

2 - We split it into even chunks of 2, if it’s an odd number we insert a place holder character “x” is the default choice, we also insert x if there’s a double letter. e.g., “hello” -> “he lx lo”

3 – We iterate over the 2 letter combinations. And find where their both row number and column number on the grid (through iteration)

4 – Then we check for 3 conditions

• The two letters have the same row number.

• The two letters have the same column number.

• They have different row and column numbers.

We then apply the Playfair cipher by increasing the column number by 1 for both letters if they have the same row, increase the row number if they have the same column, or if they are different we swap the column numbers between them

Decrypt:

1 – It follows the same steps as Encrypt until increasing and decreasing part We apply Decrypt Playfair cipher by decreasing the column number by 1 for both letters if they have the same row, decrease the row number if they have the same column, or if they are different we swap the column numbers between them

playfair-cipher's People

Contributors

sal7one avatar

Watchers

 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.