-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
75 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,76 @@ | ||
# hex-transposition-cipher | ||
hexadecimal transposition cipher for shuffling hex encoded cipher text | ||
hexadecimal transposition cipher for shuffle and reverse shuffling hex encoded cipher text for nodejs and the browser. | ||
|
||
demo: https://angeal185.github.io/hex-transposition-cipher/ | ||
### Installation | ||
|
||
npm | ||
|
||
```sh | ||
$ npm install hex-transposition-cipher | ||
``` | ||
|
||
#### nodejs | ||
ensure jquery is installed. | ||
```sh | ||
$ const htc = require('hex-transposition-cipher'); | ||
``` | ||
|
||
|
||
#### browser | ||
|
||
```html | ||
<script src="./path-to/lodash.min.js"></script> | ||
<script src="./dist/htc.min.js"></script> | ||
``` | ||
|
||
### info | ||
|
||
|
||
```js | ||
// defaults | ||
{ | ||
decode: false, // set true for decrypt | ||
reverse: false, // reverse encrypted/decrypted hex string | ||
} | ||
|
||
|
||
// htc.keyGenSync() | ||
const key = htc.keyGen(); //generates random hex key from the default key | ||
console.log(key) // returns hex key ~ dont lose this | ||
|
||
|
||
/** | ||
* htc.keyGen(callback) | ||
* @param {function} callback | ||
*/ | ||
|
||
htc.keyGen(function(i){ | ||
console.log(i) // returns hex key ~ dont lose this | ||
}); | ||
|
||
|
||
/** | ||
* htc.subSync(hex, key, config) | ||
* @param {string} hex ~ hex string | ||
* @param {object} key ~ hex key | ||
* @param {object} config ~ optional options | ||
*/ | ||
|
||
let res = htc.subSync('74657374', key, {decode:false, reverse: false}) | ||
console.log(res) // returns encrypted hex string | ||
|
||
|
||
/** | ||
* htc.sub(hex, key, config, callback) | ||
* @param {string} hex ~ hex string | ||
* @param {object} key ~ hex key | ||
* @param {object} config ~ optional options | ||
* @param {function} callback | ||
*/ | ||
|
||
htc.sub(res, key, {decode:true, reverse: false}, function(i){ | ||
console.log(i) // returns decrypted hex string | ||
}) | ||
|
||
``` |