Beta 7 with some repo names changed.
This commit is contained in:
1 parent
0f7b40cca7
commit
963c19493a
3408 files changed
+462217
-15516
No files matched your search
+10
@@ -0,0 +1,10 @@
|
||||
module.exports = function xor (a, b) {
|
||||
var length = Math.min(a.length, b.length)
|
||||
var buffer = new Buffer(length)
|
||||
|
||||
for (var i = 0; i < length; ++i) {
|
||||
buffer[i] = a[i] ^ b[i]
|
||||
}
|
||||
|
||||
return buffer
|
||||
}
|
||||
+1
@@ -0,0 +1 @@
|
||||
module.exports = require('./inplace')
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
module.exports = function xorInplace (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)
|
||||
}
|
||||
+64
@@ -0,0 +1,64 @@
|
||||
{
|
||||
"_from": "buffer-xor@^1.0.3",
|
||||
"_id": "buffer-xor@1.0.3",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha1-JuYe0UIvtw3ULm42cp7VHYVf6Nk=",
|
||||
"_location": "/buffer-xor",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "range",
|
||||
"registry": true,
|
||||
"raw": "buffer-xor@^1.0.3",
|
||||
"name": "buffer-xor",
|
||||
"escapedName": "buffer-xor",
|
||||
"rawSpec": "^1.0.3",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "^1.0.3"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/browserify-aes"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/buffer-xor/-/buffer-xor-1.0.3.tgz",
|
||||
"_shasum": "26e61ed1422fb70dd42e6e36729ed51d855fe8d9",
|
||||
"_spec": "buffer-xor@^1.0.3",
|
||||
"_where": "C:\\Users\\Luis\\source\\repos\\AAMasters\\BackendServers\\node_modules\\browserify-aes",
|
||||
"author": {
|
||||
"name": "Daniel Cousens"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/crypto-browserify/buffer-xor/issues"
|
||||
},
|
||||
"bundleDependencies": false,
|
||||
"deprecated": false,
|
||||
"description": "A simple module for bitwise-xor on buffers",
|
||||
"devDependencies": {
|
||||
"mocha": "*",
|
||||
"standard": "*"
|
||||
},
|
||||
"homepage": "https://github.com/crypto-browserify/buffer-xor",
|
||||
"keywords": [
|
||||
"bits",
|
||||
"bitwise",
|
||||
"buffer",
|
||||
"buffer-xor",
|
||||
"crypto",
|
||||
"inline",
|
||||
"math",
|
||||
"memory",
|
||||
"performance",
|
||||
"xor"
|
||||
],
|
||||
"license": "MIT",
|
||||
"main": "index.js",
|
||||
"name": "buffer-xor",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/crypto-browserify/buffer-xor.git"
|
||||
},
|
||||
"scripts": {
|
||||
"standard": "standard",
|
||||
"test": "npm run-script unit",
|
||||
"unit": "mocha"
|
||||
},
|
||||
"version": "1.0.3"
|
||||
}
|
||||
+23
@@ -0,0 +1,23 @@
|
||||
[
|
||||
{
|
||||
"a": "000f",
|
||||
"b": "f0ff",
|
||||
"expected": "f0f0"
|
||||
},
|
||||
{
|
||||
"a": "000f0f",
|
||||
"b": "f0ff",
|
||||
"mutated": "f0f00f",
|
||||
"expected": "f0f0"
|
||||
},
|
||||
{
|
||||
"a": "000f",
|
||||
"b": "f0ffff",
|
||||
"expected": "f0f0"
|
||||
},
|
||||
{
|
||||
"a": "000000",
|
||||
"b": "000000",
|
||||
"expected": "000000"
|
||||
}
|
||||
]
|
||||
+38
@@ -0,0 +1,38 @@
|
||||
/* global describe, it */
|
||||
|
||||
var assert = require('assert')
|
||||
var xor = require('../')
|
||||
var xorInplace = require('../inplace')
|
||||
var fixtures = require('./fixtures')
|
||||
|
||||
describe('xor', function () {
|
||||
fixtures.forEach(function (f) {
|
||||
it('returns ' + f.expected + ' for ' + f.a + '/' + f.b, function () {
|
||||
var a = new Buffer(f.a, 'hex')
|
||||
var b = new Buffer(f.b, 'hex')
|
||||
var actual = xor(a, b)
|
||||
|
||||
assert.equal(actual.toString('hex'), f.expected)
|
||||
|
||||
// a/b unchanged
|
||||
assert.equal(a.toString('hex'), f.a)
|
||||
assert.equal(b.toString('hex'), f.b)
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
describe('xor/inplace', function () {
|
||||
fixtures.forEach(function (f) {
|
||||
it('returns ' + f.expected + ' for ' + f.a + '/' + f.b, function () {
|
||||
var a = new Buffer(f.a, 'hex')
|
||||
var b = new Buffer(f.b, 'hex')
|
||||
var actual = xorInplace(a, b)
|
||||
|
||||
assert.equal(actual.toString('hex'), f.expected)
|
||||
|
||||
// a mutated, b unchanged
|
||||
assert.equal(a.toString('hex'), f.mutated || f.expected)
|
||||
assert.equal(b.toString('hex'), f.b)
|
||||
})
|
||||
})
|
||||
})
|
||||
Reference in new issue
Block a user