js-senc - js implementation of senc
WARNING: Library uses pull-streams.
Works in node.js and the browser. Uses libp2p-crypto.
npm install --save senc
var senc = require('senc')
var stdio = require('pull-stdio')
var key = senc.RandomKey()
pull(
stdio.stdin({encoding: binary}),
senc.EncryptStream(key),
stdio.stdout(() => {})
)
var senc = require('senc')
var stdio = require('pull-stdio')
var key = <key-from-above>
pull(
stdio.stdin({encoding: binary}),
senc.DecryptStream(key),
stdio.stdout(() => {})
)
var senc = require('senc')
console.log(senc.RandomKey())
npm install --global senc
usage: senc -e -k <key> - encrypt stdin with aes
senc -d -k <key> - decrypt stdin with aes
OPTIONS
-h, --help this help text
-d set decrypt mode
-e set encrypt mode
-k <string> key to use (in multibase)
-b <base> the multibase encoding to write key to
--key-gen generate a key
> senc --key-gen
zEkHKdVKVUazjMndot4puCyA57Ji7vH6VhemsNk8vvkhi
> key=$(senc --key-gen)
senc -k zEkHKdVKVUazjMndot4puCyA57Ji7vH6VhemsNk8vvkhi -e <plaintext >ciphertext
senc -k zEkHKdVKVUazjMndot4puCyA57Ji7vH6VhemsNk8vvkhi -d <ciphertext >plaintext2
# keygen
senckey=$(senc --key-gen)
# encrypt
senc -k $senckey -e <plaintext >ciphertext
# decrypt
senc -k $senckey -d <ciphertext >plaintext2
# check the diff
diff plaintext plaintext2