https://github.com/browserify/buffer-xor
A simple module for bitwise-xor on buffers
https://github.com/browserify/buffer-xor
bitwise-xor buffer buffer-xor cryptography javascript xor
Last synced: 7 months ago
JSON representation
A simple module for bitwise-xor on buffers
- Host: GitHub
- URL: https://github.com/browserify/buffer-xor
- Owner: browserify
- License: mit
- Created: 2015-05-21T05:17:58.000Z (almost 11 years ago)
- Default Branch: master
- Last Pushed: 2024-12-21T10:00:38.000Z (over 1 year ago)
- Last Synced: 2025-03-31T17:08:16.791Z (12 months ago)
- Topics: bitwise-xor, buffer, buffer-xor, cryptography, javascript, xor
- Language: JavaScript
- Homepage:
- Size: 12.7 KB
- Stars: 30
- Watchers: 1
- Forks: 9
- Open Issues: 5
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# buffer-xor
[](https://www.npmjs.org/package/buffer-xor)
[](https://travis-ci.org/crypto-browserify/buffer-xor)
[](https://github.com/feross/standard)
A simple module for bitwise-xor on buffers.
## Examples
``` javascript
var xor = require('buffer-xor')
var a = new Buffer('00ff0f', 'hex')
var b = new Buffer('f0f0', 'hex')
console.log(xor(a, b))
// =>
```
Or for those seeking those few extra cycles, perform the operation in place with
`xorInplace`:
_NOTE: `xorInplace` won't xor past the bounds of the buffer it mutates so make
sure it is long enough!_
``` javascript
var xorInplace = require('buffer-xor/inplace')
var a = new Buffer('00ff0f', 'hex')
var b = new Buffer('f0f0', 'hex')
console.log(xorInplace(a, b))
// =>
// See that a has been mutated
console.log(a)
// =>
```
## License [MIT](LICENSE)