https://github.com/guerrerocarlos/stream-cipher
Stream Cipher/Decipher, (Amazon S3 ranged GET compatible)
https://github.com/guerrerocarlos/stream-cipher
Last synced: 4 months ago
JSON representation
Stream Cipher/Decipher, (Amazon S3 ranged GET compatible)
- Host: GitHub
- URL: https://github.com/guerrerocarlos/stream-cipher
- Owner: guerrerocarlos
- Created: 2017-03-17T13:05:29.000Z (about 8 years ago)
- Default Branch: master
- Last Pushed: 2017-03-28T19:33:35.000Z (about 8 years ago)
- Last Synced: 2025-02-08T00:39:01.655Z (4 months ago)
- Language: JavaScript
- Homepage:
- Size: 6.84 KB
- Stars: 2
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
Stream Cipher
===Cipher and decipher streams 'on the fly' while keeping each byte position.
Specially designed for Amazon S3 ranged GETs.
API
===#### `var sc = StreamCipher(initialization_vector, password, speed, encript, start_at_byte)`
Create a new engine instance. Options can contain the following
- initialization_vector: 'string' // (**required**)
- password: 'string' // (**required**)
- speed: 'number' // default: 20 | Increases the speed by generating HMACs less frequently
- encript: Boolean // default: true | true: cipher, false: decipher
- start_at_byte: Tells de position of the first byte received by the stream, relative to the complete file.Cipher Stream Example:
---
```javascript
var StreamCipher = require('stream-cipher')
var initialization_vector = "private_init_vector_string"
var password = "123dontusethispassword"var sc = new StreamCipher(initialization_vector, password, 20, true)
var origin = fs.createReadStream('./lipsum.txt');
var destination = fs.createWriteStream('./lipsum-encripted.txt');
origin.pipe(sc.digest).pipe(destination)
```Decipher Stream Example:
---
```javascript
var StreamCipher = require('stream-cipher')
var initialization_vector = "private_init_vector_string"
var password = "123dontusethispassword"var sc = new StreamCipher(initialization_vector, password, 20, false)
var origin = fs.createReadStream('./lipsum-encripted.txt');
var destination = fs.createWriteStream('./lipsum-decripted.txt');
origin.pipe(sc.digest).pipe(destination)
```Decipher Stream without first 10 bytes:
---
```javascript
var StreamCipher = require('stream-cipher')
var initialization_vector = "private_init_vector_string"
var password = "123dontusethispassword"var sc = new StreamCipher(initialization_vector, password, 20, false, 10)
var origin = fs.createReadStream('./lipsum-encripted-without-first-10-bytes.txt');
var destination = fs.createWriteStream('./lipsum-decripted-without-first-10-bytes.txt');
origin.pipe(sc.digest).pipe(destination)
```For more information, see /test folder.