mirror of
https://github.com/cp6/my-idlers.git
synced 2024-11-16 23:42:32 +01:00
fd22b0bf58
V2 (Laravel re-make)
18 lines
342 B
JavaScript
Vendored
18 lines
342 B
JavaScript
Vendored
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)
|
|
}
|