Skip to content

Matsukii/OneTimePad

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 

Repository files navigation

OneTimePad

OneTimePad cipher in Javascript

This is a modified version of karai17/One-Time-Pad

installation

Clone or download this repo and include in your project folder

  • include main file <script src="OneTimePad0.1/oneTimePad.js"></script>

  • include jQuery
    <script src="jquery-3.3.1.min.js"></script>
    *or
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.5.1/jquery.min.js"></script>

  • Go to OneTimePad.js and set the path where the file are in
    var pathToThisFile = "OneTimePad0.1/";

Usage

  • encrypt:
    Call function encrypt("message", "yourkey")

    the output will be in JSON like this: {"msg":"MESSAGE","key":"YOURKEY","out":"LTNKLLD"}
    if no key was givem or leaved blank - encrypt("message", ""); - a key will be generated with same length of the text

  • decrypt:
    Call function decrypt("text", "key")

    return will be in JSON like this: {"msg":"LTNKLLD","key":"YOURKEY","out":"MESSAGE"}

  • testOTP:
    Print a test with message = "test" and key = "" in console

Credits

This 'library' was based on one-time-pad implementation of karai17/One-Time-Pad adapted for command line and general pourpose usage.

License

MIT license