File tree Expand file tree Collapse file tree 2 files changed +26
-15
lines changed
Expand file tree Collapse file tree 2 files changed +26
-15
lines changed Original file line number Diff line number Diff line change @@ -4,6 +4,7 @@ import { Ige } from "../src/block-modes/ige.ts";
44
55const key = new Uint8Array ( 16 ) ;
66const iv = new Uint8Array ( Aes . BLOCK_SIZE ) ;
7+ const iv2 = new Uint8Array ( Aes . BLOCK_SIZE * 2 ) ;
78const data = new Uint8Array ( 1024 * 1024 * 2 ) ;
89
910Deno . bench ( {
@@ -38,6 +39,29 @@ Deno.bench({
3839 } ,
3940} ) ;
4041
42+ Deno . bench ( {
43+ name : "AES-128-CBC 2MiB Encrypt (WebCrypto)" ,
44+ async fn ( ) {
45+ const ckey = await crypto . subtle . importKey (
46+ "raw" ,
47+ key ,
48+ {
49+ name : "AES-CBC" ,
50+ } ,
51+ true ,
52+ [ "encrypt" ] ,
53+ ) ;
54+ await crypto . subtle . encrypt (
55+ {
56+ name : "AES-CBC" ,
57+ iv,
58+ } ,
59+ ckey ,
60+ data ,
61+ ) ;
62+ } ,
63+ } ) ;
64+
4165Deno . bench ( {
4266 name : "AES-128-CFB 2MiB Encrypt" ,
4367 fn ( ) {
@@ -73,15 +97,15 @@ Deno.bench({
7397Deno . bench ( {
7498 name : "AES-128-IGE 2MiB Encrypt" ,
7599 fn ( ) {
76- const cipher = new Ige ( Aes , key , new Uint8Array ( Aes . BLOCK_SIZE * 2 ) ) ;
100+ const cipher = new Ige ( Aes , key , iv2 ) ;
77101 cipher . encrypt ( data ) ;
78102 } ,
79103} ) ;
80104
81105Deno . bench ( {
82106 name : "AES-128-IGE 2MiB Decrypt" ,
83107 fn ( ) {
84- const cipher = new Ige ( Aes , key , new Uint8Array ( Aes . BLOCK_SIZE * 2 ) ) ;
108+ const cipher = new Ige ( Aes , key , iv2 ) ;
85109 cipher . decrypt ( data ) ;
86110 } ,
87111} ) ;
Load Diff This file was deleted.
You can’t perform that action at this time.
0 commit comments