Skip to content
master
Switch branches/tags
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
 
 
 
 
 
 
 
 

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

About

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

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published