aswi2020vldc-gitlab/templetes/node_modules/browserify-aes/modes/cbc.js @ 9b6ff40e
1 |
var xor = require('buffer-xor') |
---|---|
2 |
|
3 |
exports.encrypt = function (self, block) { |
4 |
var data = xor(block, self._prev) |
5 |
|
6 |
self._prev = self._cipher.encryptBlock(data) |
7 |
return self._prev |
8 |
}
|
9 |
|
10 |
exports.decrypt = function (self, block) { |
11 |
var pad = self._prev |
12 |
|
13 |
self._prev = block |
14 |
var out = self._cipher.decryptBlock(block) |
15 |
|
16 |
return xor(out, pad) |
17 |
}
|