🚀 Big News:Socket Has Acquired Secure Annex.Learn More →
Socket
Book a DemoSign in
Socket

xor-stream

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

xor-stream

Take two readable streams and return a readable stream with the xor of the two input chunks

latest
Source
npmnpm
Version
1.0.0
Version published
Maintainers
1
Created
Source

xor-stream

Take two readable streams and return a readable stream that contains chunkB XOR chunkB

npm install xor-stream

Build Status

This can be used to calculate pairty blobs of the contents of two streams.

Example

var xorStream = require('xor-stream')
var streamEqual = require('stream-equal')
var rs = require('fs').createReadStream

var pairty = xorStream(rs('pathA'), rs('pathB'))
var contentOfA = xorStream(pairty, rs('pathB'))

streamEqual(rs('pathA'), contentOfA, function (err, equal) {
  console.log(equal) // true if file A is larger than File B
})

Right now, if one file is longer than the other, xor-stream pads the shorter stream with 0 bytes, so recovering shorter files from the longer file XOR pairty will have extra byte padding at the end.

Background

Keywords

xor

FAQs

Package last updated on 07 Mar 2016

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts