flow like the river
This commit is contained in:
commit
013fe673f3
42435 changed files with 5764238 additions and 0 deletions
27
BACK_BACK/node_modules/browserify-aes/streamCipher.js
generated
vendored
Executable file
27
BACK_BACK/node_modules/browserify-aes/streamCipher.js
generated
vendored
Executable file
|
|
@ -0,0 +1,27 @@
|
|||
var aes = require('./aes')
|
||||
var Buffer = require('safe-buffer').Buffer
|
||||
var Transform = require('cipher-base')
|
||||
var inherits = require('inherits')
|
||||
|
||||
function StreamCipher (mode, key, iv, decrypt) {
|
||||
Transform.call(this)
|
||||
|
||||
this._cipher = new aes.AES(key)
|
||||
this._prev = Buffer.from(iv)
|
||||
this._cache = Buffer.allocUnsafe(0)
|
||||
this._secCache = Buffer.allocUnsafe(0)
|
||||
this._decrypt = decrypt
|
||||
this._mode = mode
|
||||
}
|
||||
|
||||
inherits(StreamCipher, Transform)
|
||||
|
||||
StreamCipher.prototype._update = function (chunk) {
|
||||
return this._mode.encrypt(this, chunk, this._decrypt)
|
||||
}
|
||||
|
||||
StreamCipher.prototype._final = function () {
|
||||
this._cipher.scrub()
|
||||
}
|
||||
|
||||
module.exports = StreamCipher
|
||||
Loading…
Add table
Add a link
Reference in a new issue