Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: remove buffer-xor dependency, use our own version instead #63

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion authCipher.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ var Buffer = require('safe-buffer').Buffer
var Transform = require('cipher-base')
var inherits = require('inherits')
var GHASH = require('./ghash')
var xor = require('buffer-xor')
var xor = require('./xor')
var incr32 = require('./incr32')

function xorTest (a, b) {
Expand Down
2 changes: 1 addition & 1 deletion modes/cbc.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
var xor = require('buffer-xor')
var xor = require('../xor')

exports.encrypt = function (self, block) {
var data = xor(block, self._prev)
Expand Down
2 changes: 1 addition & 1 deletion modes/cfb.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
var Buffer = require('safe-buffer').Buffer
var xor = require('buffer-xor')
var xor = require('../xor')

function encryptStart (self, data, decrypt) {
var len = data.length
Expand Down
2 changes: 1 addition & 1 deletion modes/ctr.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
var xor = require('buffer-xor')
var xor = require('../xor')
var Buffer = require('safe-buffer').Buffer
var incr32 = require('../incr32')

Expand Down
2 changes: 1 addition & 1 deletion modes/ofb.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
var xor = require('buffer-xor')
var xor = require('../xor')

function getBlock (self) {
self._prev = self._cipher.encryptBlock(self._prev)
Expand Down
1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@
},
"homepage": "https://github.com/crypto-browserify/browserify-aes",
"dependencies": {
"buffer-xor": "^1.0.3",
"cipher-base": "^1.0.0",
"create-hash": "^1.1.0",
"evp_bytestokey": "^1.0.3",
Expand Down
12 changes: 12 additions & 0 deletions xor.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
var Buffer = require('safe-buffer').Buffer

module.exports = function xor (a, b) {
var length = Math.min(a.length, b.length)
var buffer = Buffer.allocUnsafe(length)

for (var i = 0; i < length; ++i) {
buffer[i] = a[i] ^ b[i]
}

return buffer
}