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:
var StreamCipher = var initialization_vector = "private_init_vector_string"var password = "123dontusethispassword" var sc = initialization_vector password 20 truevar origin = fs;var destination = fs;origin
Decipher Stream Example:
var StreamCipher = var initialization_vector = "private_init_vector_string"var password = "123dontusethispassword" var sc = initialization_vector password 20 falsevar origin = fs;var destination = fs;origin
Decipher Stream without first 10 bytes:
var StreamCipher = var initialization_vector = "private_init_vector_string"var password = "123dontusethispassword" var sc = initialization_vector password 20 false 10var origin = fs;var destination = fs;origin
For more information, check the see the /test folder.