Giter Site home page Giter Site logo

rbleattler / poshciphers Goto Github PK

View Code? Open in Web Editor NEW

This project forked from stackcrash/poshciphers

0.0 1.0 0.0 63 KB

PowerShell module for enciphering and deciphering Caesar, Vigenere, and Substitution ciphers. The module will also brute force Caesar and Vigenere ciphers.

License: MIT License

PowerShell 100.00%

poshciphers's Introduction

PoshCiphers

PowerShell module for enciphering and deciphering Caesar, Vigenere, and Substitution ciphers. The module will also brute force Caesar and Vigenere ciphers.

Install

  • Clone the repo
  • Import the module
Import-Module C:\Path\To\Cloned\Location\PoshCiphers\PoshCiphers\PoshCiphers.psd1

Usage

Encipher

Caesar (Rotation)

Invoke-PCCaesarEncipher -Plaintext "Example" -Rotation 13

Plaintext Ciphertext Rotation
--------- ---------- --------
Example   Rknzcyr          13

Substitution

Invoke-PCSubEncipher -Plaintext "Example"

PlainText         Ciphertext         Substitution
---------         ----------         ------------
Example           Ixtvksi            TYNFIRMBHEGSVULKWQJDPACXO

Vigenere

Invoke-PCVigenereEncipher -Plaintext "Example" -Key "password"

Plaintext Ciphertext Key
--------- ---------- ---
Example   Txselzv    password

Decipher

Caesar (Rotation)

Invoke-PCCaesarDecipher -Ciphertext "Rknzcyr" -Rotation 13

Plaintext Ciphertext Rotation
--------- ---------- --------
Example   Rknzcyr          13

Substitution

Invoke-PCSubDecipher -Ciphertext "Ixtvksi" -Substitution "TYNFIRMBHEGSVULKWQJDPACXO"

PlainText         Ciphertext         Substitution
---------         ----------         ------------
Example           Ixtvksi            TYNFIRMBHEGSVULKWQJDPACXO

Vigenere

Invoke-PCVigenereDecipher -Ciphertext "Txselzv" -Key "password"

Plaintext Ciphertext Key
--------- ---------- ---
Example   Txselzv    password

Bruteforcing

Caesar

The longer the ciphertext the more likely it is to return an accurate result like below. The lower the entropy the more likely the match is correct.

Invoke-PCBruteForceCaesar -Ciphertext "Drsc sc kx ohkwzvo drkd cryevn lo vyxq oxyeqr"

Plaintext                                     Ciphertext                                    Rotation           Entropy
---------                                     ----------                                    --------           ------
This is an example that should be long enough Drsc sc kx ohkwzvo drkd cryevn lo vyxq oxyeqr       10 109.798786942039

When the ciphertext is too short it might be benefitial to return multiple results.

Invoke-PCBruteForceCaesar -Ciphertext "Ohkwzvo" -Return 6

Plaintext Ciphertext Rotation           Entropy
--------- ---------- --------           ------
Atwilha   Ohkwzvo          14 19.8330281092882
Lehtwsl   Ohkwzvo           3 20.1951620075682
Hadpsoh   Ohkwzvo           7 20.5561918374628
Tmpbeat   Ohkwzvo          21 21.2523902999804
Wpsehdw   Ohkwzvo          18 22.2203513815375
Example   Ohkwzvo          10 24.0221984573182

Vigenere

As with Caesar the longer the ciphertext the more likely it is to return and accurate results. Additionally, the maximum key length also plays into the more accuracy of results.

Invoke-PCBruteForceVigenere -Ciphertext 'Zls tnsogs wuv sebborj pwvy fkxkvkr lvsvjss ebu nevtwekwy ebu lsx xvv mvkeh sapq st dgrqmbu nevtwekwy mg skxzif'

PlainText                                Ciphertext                               Key                           Entropy
---------                                ----------                               ---                           -------
The choice for mankind lies between      Zls tnsogs wuv sebborj pwvy fkxkvkr      GEORGE               184.669755696769
freedom and happiness and for the great  lvsvjss ebu nevtwekwy ebu lsx xvv mvkeh
bulk of mankind happiness is better      sapq st dgrqmbu nevtwekwy mg skxzif

When lowering the max key length it can eliminate inaccurate results that occur when the key length tested is significantly longer than the actual key and it also increases the speed of the brute force.

Invoke-PCBruteForceVigenere -Ciphertext 'Zls tnsogs wuv sebborj pwvy fkxkvkr lvsvjss ebu nevtwekwy ebu lsx xvv mvkeh sapq st dgrqmbu nevtwekwy mg skxzif' -MaxKeyLength 10

PlainText                                Ciphertext                               Key                           Entropy
---------                                ----------                               ---                           -------
The choice for mankind lies between      Zls tnsogs wuv sebborj pwvy fkxkvkr      GEORGE               184.669755696769
freedom and happiness and for the great  lvsvjss ebu nevtwekwy ebu lsx xvv mvkeh
bulk of mankind happiness is better      sapq st dgrqmbu nevtwekwy mg skxzif

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.