Socket
Socket
Sign inDemoInstall

buffer-xor

Package Overview
Dependencies
0
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 1.0.2 to 1.0.3

inplace.js

10

inline.js

@@ -1,9 +0,1 @@

module.exports = function xorInline (a, b) {
var length = Math.min(a.length, b.length)
for (var i = 0; i < length; ++i) {
a[i] = a[i] ^ b[i]
}
return a.slice(0, length)
}
module.exports = require('./inplace')
{
"name": "buffer-xor",
"version": "1.0.2",
"description": "buffer-xor",
"version": "1.0.3",
"description": "A simple module for bitwise-xor on buffers",
"main": "index.js",

@@ -6,0 +6,0 @@ "scripts": {

# buffer-xor
[![TRAVIS](https://secure.travis-ci.org/dcousens/buffer-xor.png)](http://travis-ci.org/dcousens/PROJECTNAME)
[![NPM](http://img.shields.io/npm/v/buffer-xor.svg)](https://www.npmjs.org/package/PROJECTNAME)
[![TRAVIS](https://secure.travis-ci.org/crypto-browserify/buffer-xor.png)](http://travis-ci.org/crypto-browserify/buffer-xor)
[![NPM](http://img.shields.io/npm/v/buffer-xor.svg)](https://www.npmjs.org/package/buffer-xor)
[![js-standard-style](https://cdn.rawgit.com/feross/standard/master/badge.svg)](https://github.com/feross/standard)
A simple module for bitwise-xor on buffers.
## Example
## Examples
``` javascript

@@ -20,10 +22,13 @@ var xor = require("buffer-xor")

Or for those seeking those few extra cycles, perform the operation inline:
Or for those seeking those few extra cycles, perform the operation in place:
``` javascript
var xorInline = require("buffer-xor/inline")
var xorInplace = require("buffer-xor/inplace")
var a = new Buffer('00ff0f', 'hex')
var b = new Buffer('f0f0', 'hex')
console.log(xorInline(a, b))
console.log(xorInplace(a, b))
// => <Buffer f0 0f>
// NOTE: xorInplace will return the shorter slice of its parameters

@@ -36,4 +41,3 @@ // See that a has been mutated

## License
## License [MIT](LICENSE)
This library is free and open-source software released under the MIT license.

@@ -5,3 +5,3 @@ /* global describe, it */

var xor = require('../')
var xorInline = require('../inline')
var xorInplace = require('../inplace')
var fixtures = require('./fixtures')

@@ -25,3 +25,3 @@

describe('xor/inline', function () {
describe('xor/inplace', function () {
fixtures.forEach(function (f) {

@@ -31,3 +31,3 @@ it('returns ' + f.expected + ' for ' + f.a + '/' + f.b, function () {

var b = new Buffer(f.b, 'hex')
var actual = xorInline(a, b)
var actual = xorInplace(a, b)

@@ -34,0 +34,0 @@ assert.equal(actual.toString('hex'), f.expected)

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc