import { Buffer } from "../../../buffer.ts";
import * as aes from "./aes.js";import Transform from "../cipher_base.js";
export 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;}
StreamCipher.prototype = Object.create(Transform.prototype, { constructor: { value: StreamCipher, enumerable: false, writable: true, configurable: true, },});
StreamCipher.prototype._update = function (chunk) { return this._mode.encrypt(this, chunk, this._decrypt);};
StreamCipher.prototype._final = function () { this._cipher.scrub();};
export default StreamCipher;