Web Encrypt API (Decrypt)

Benchmark created on


Test runner

Ready to run.

Testing in
TestOps/sec
CTR
(async () => {
	let counter;
  
  const message = "vBXGjoJXe9qc/tZIQNI=";

  const key = await crypto.subtle.importKey(
    'raw',
    Uint8Array.from([
      240, 177, 43, 175, 196, 28, 171, 18, 163, 22, 239, 213, 108, 230, 155,
      68,
    ]).buffer,
    'AES-CTR',
    false,
    ['decrypt']
  );
    
	counter = Uint8Array.from([
    148, 244, 182, 151, 107, 138, 65, 198, 4, 242, 242, 118, 3, 1, 195, 119,
  ]);
  
  const decryptedContent = await window.crypto.subtle.decrypt(
    {
      name: 'AES-CTR',
      counter,
      length: 64,
    },
    key,
    Uint8Array.from(atob(message), c => c.charCodeAt(0))
  )
})();
ready
GCM
(async () => {
	let iv;
  
  const message = "jKZvuKmLpmooLqb6rWkz1tolUxgj59JCWlQdCdfz";

  const key = await crypto.subtle.importKey(
    'raw',
    Uint8Array.from([
      240, 177, 43, 175, 196, 28, 171, 18, 163, 22, 239, 213, 108, 230, 155,
      68,
    ]).buffer,
    'AES-GCM',
    false,
    ['decrypt']
  );
    
	iv = Uint8Array.from([
    148, 244, 182, 151, 107, 138, 65, 198, 4, 242, 242, 118, 3, 1, 195, 119,
  ]);
  
  const decryptedContent = await window.crypto.subtle.decrypt(
    {
      name: 'AES-GCM',
      iv,
    },
    key,
    Uint8Array.from(atob(message), c => c.charCodeAt(0))
  )
})();
ready
CBC
(async () => {
	let iv;
  
  const message = "r35r3IBuFB9cGFzcg8QIWw==";

  const key = await crypto.subtle.importKey(
    'raw',
    Uint8Array.from([
      240, 177, 43, 175, 196, 28, 171, 18, 163, 22, 239, 213, 108, 230, 155,
      68,
    ]).buffer,
    'AES-CBC',
    false,
    ['decrypt']
  );
    
	iv = Uint8Array.from([
    148, 244, 182, 151, 107, 138, 65, 198, 4, 242, 242, 118, 3, 1, 195, 119,
  ]);
  
  const decryptedContent = await window.crypto.subtle.decrypt(
    {
      name: 'AES-CBC',
      iv,
    },
    key,
    Uint8Array.from(atob(message), c => c.charCodeAt(0))
  )
})();
ready

Revisions

You can edit these tests or add more tests to this page by appending /edit to the URL.