您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

12345678910111213141516
  1. var xor = require('buffer-xor')
  2. function getBlock (self) {
  3. self._prev = self._cipher.encryptBlock(self._prev)
  4. return self._prev
  5. }
  6. exports.encrypt = function (self, chunk) {
  7. while (self._cache.length < chunk.length) {
  8. self._cache = Buffer.concat([self._cache, getBlock(self)])
  9. }
  10. var pad = self._cache.slice(0, chunk.length)
  11. self._cache = self._cache.slice(chunk.length)
  12. return xor(chunk, pad)
  13. }