Projekt

Obecné

Profil

Stáhnout (1014 Bajtů) Statistiky
| Větev: | Revize:
1
# buffer-xor
2

    
3
[![TRAVIS](https://secure.travis-ci.org/crypto-browserify/buffer-xor.png)](http://travis-ci.org/crypto-browserify/buffer-xor)
4
[![NPM](http://img.shields.io/npm/v/buffer-xor.svg)](https://www.npmjs.org/package/buffer-xor)
5

    
6
[![js-standard-style](https://cdn.rawgit.com/feross/standard/master/badge.svg)](https://github.com/feross/standard)
7

    
8
A simple module for bitwise-xor on buffers.
9

    
10

    
11
## Examples
12

    
13
``` javascript
14
var xor = require("buffer-xor")
15
var a = new Buffer('00ff0f', 'hex')
16
var b = new Buffer('f0f0', 'hex')
17

    
18
console.log(xor(a, b))
19
// => <Buffer f0 0f>
20
```
21

    
22

    
23
Or for those seeking those few extra cycles, perform the operation in place:
24

    
25
``` javascript
26
var xorInplace = require("buffer-xor/inplace")
27
var a = new Buffer('00ff0f', 'hex')
28
var b = new Buffer('f0f0', 'hex')
29

    
30
console.log(xorInplace(a, b))
31
// => <Buffer f0 0f>
32
// NOTE: xorInplace will return the shorter slice of its parameters
33

    
34
// See that a has been mutated
35
console.log(a)
36
// => <Buffer f0 0f 0f>
37
```
38

    
39

    
40
## License [MIT](LICENSE)
41

    
(4-4/8)