katoikia-app/web-ui/web-react/node_modules/browserify-aes/modes/cbc.js

18 lines
342 B
JavaScript
Raw Normal View History

2022-07-06 04:15:11 +00:00
var xor = require('buffer-xor')
exports.encrypt = function (self, block) {
var data = xor(block, self._prev)
self._prev = self._cipher.encryptBlock(data)
return self._prev
}
exports.decrypt = function (self, block) {
var pad = self._prev
self._prev = block
var out = self._cipher.decryptBlock(block)
return xor(out, pad)
}