aswi2020vldc-gitlab/templetes/node_modules/browserify-aes/modes/ofb.js @ 3a515b92
1 |
var xor = require('buffer-xor') |
---|---|
2 |
|
3 |
function getBlock (self) { |
4 |
self._prev = self._cipher.encryptBlock(self._prev) |
5 |
return self._prev |
6 |
}
|
7 |
|
8 |
exports.encrypt = function (self, chunk) { |
9 |
while (self._cache.length < chunk.length) { |
10 |
self._cache = Buffer.concat([self._cache, getBlock(self)]) |
11 |
}
|
12 |
|
13 |
var pad = self._cache.slice(0, chunk.length) |
14 |
self._cache = self._cache.slice(chunk.length) |
15 |
return xor(chunk, pad) |
16 |
}
|
- « Předchozí
- 1
- …
- 7
- 8
- 9
- Další »