Skip to content

Commit

Permalink
init
Browse files Browse the repository at this point in the history
  • Loading branch information
angeal185 committed Apr 27, 2019
1 parent 167b3a5 commit 99aae61
Showing 1 changed file with 75 additions and 1 deletion.
76 changes: 75 additions & 1 deletion README.md
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
})

```

0 comments on commit 99aae61

Please sign in to comment.