[aes-js] Counter allows for either a number or a ByteSource (#43719)

* Counter allows for either a number or a ByteSource

* Add unit test
This commit is contained in:
Michael Gates
2020-04-08 13:08:58 -07:00
committed by GitHub
parent 5dbf929af4
commit 07e5a5902a
2 changed files with 4 additions and 1 deletions
+3
View File
@@ -8,3 +8,6 @@ const ecb = new aesjs.ModeOfOperation.ecb(key);
ecb.decrypt(ecb.encrypt(data));
const hex: string = aesjs.utils.hex.fromBytes(data);
const ctr = new aesjs.ModeOfOperation.ctr(key, new aesjs.Counter([]));
ctr.encrypt(data);
+1 -1
View File
@@ -19,7 +19,7 @@ export class AES {
* @param initialValue The Counter initial value.
*/
export class Counter {
constructor(initialValue: number)
constructor(initialValue: number | ByteSource)
setValue(value: number): void;
setBytes(bytes: ByteSource): void;
increment(): void;