Skip to content

littledivy/deno-ciphers

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

74 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

deno-ciphers

stars issues deno version vr scripts

Encipher and Decipher implementation for Deno.

Implementations

  • Vigenere
  • ADFGVX
  • ADFGX
  • Affine
  • Atbash
  • Autokey
  • Beaufort
  • Caesar
  • ColumnarTransposition
  • FourSquare
  • FractionatedMourse
  • PlayFair
  • PolybiusSqaure
  • Porta
  • RailFence
  • Rot13
  • RunningKey
  • Substitution

Example

import { toVigenere, fromVigenere } from 'mod.ts';

toVigenere("key", "string"); // "CXPSRE"
fromVigenere("key", "CXPSRE"); // "string"

Join Discord

Rules

  • Vigenere

    • key should be alphabetic.
  • ADFGVX

    • key < 36 in length.
    • key should not contain repeated chars.
    • key and keyword should be a valid ascii.
  • ADFGX

    • key < 25 in length.
    • key should not contain repeated chars.
    • key and keyword should be a valid ascii.
  • Affine

    • a should be in the range [1, 25].
    • b should be in the range [1, 25].
    • a should not be relatively prime to 26.
  • Atbash

    • no rules
  • AutoKey

    • key should be alphabetic.
  • Beaufort

    • key should be alphabetic.
  • Caesar

    • no rules
  • ColumnarTransposition

    • key should be a valid ascii.
  • FourSquare

    • alphabet, key1, key2 should be 25 chars in length.
    • alphabet should be a valid ascii.
    • alphabet, key1, key2 should not contain repeated chars.
    • All of the chars in key1 and key2 should be in alphabet.
    • pad should be contained in alphabet.
  • Playfair

    • key should 25 chars in length.
    • key should be a valid ascii.
    • key should not contain repeated characters.
    • pad should not be contained within key.
  • PolybiusSqaure

    • key should be a valid ascii.
    • key should not contain repeated characters.
    • chars should be a valid ascii.
    • chars should not contain repeated characters.
    • length of chars should be equal to sqrt(key.length()), and key should be of length chars.length()^2.
  • Porta

    • key should be alphabetic.
  • RailFence

    • key should not be less than or equal to 0.
  • RunningKey

    • key should be alphabetic.
  • Substitution

    • key should be 26 characters in length.
    • key should not contain repeated chars.
    • key should be alphabetic.

Building from source

Prerequisites

Building

$ deno run -A scripts/build.ts

Testing

Requires wasm.js to be built first.

$ deno test

Contribution

Pull request, issues and feedback are very welcome. Code style is formatted with deno fmt and commit messages are done following Conventional Commits spec.

Licence

Copyright 2020, Divy Srivastava. All rights reserved. MIT license.