OneTimePad cipher in Javascript
This is a modified version of karai17/One-Time-Pad
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/";
-
encrypt:
Call functionencrypt("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 functiondecrypt("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
This 'library' was based on one-time-pad implementation of karai17/One-Time-Pad adapted for command line and general pourpose usage.
MIT license