Time slots app prototype
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

21 lines
704 B

import * as aes from "./aes";
import Transform from "../cipher-base";
import { inherits as inherits$0 } from "util";
var inherits = { inherits: inherits$0 }.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();
};
export default StreamCipher;