Reference

Web Crypto API Reference

Web Crypto API algorithms, limits and safety notes for browser tools.

Overview

The Web Crypto API provides browser-native cryptographic primitives for hashing, key generation and encryption demos. It is useful for local developer tools, but production security still depends on key management, algorithm choice, random IVs and careful handling of secrets.

Debugging Reference Table

FeatureSupported useDebugging and safety note
crypto.subtle.digest("SHA-256")Generate SHA-256 digestsUseful for checksums and examples, not encryption.
crypto.subtle.digest("SHA-1")Generate SHA-1 digestsLegacy compatibility only; avoid for security-sensitive workflows.
MD5Not supported by Web CryptoDo not use MD5 for password storage or modern security.
AES-GCMAuthenticated symmetric encryptionRequires unique IV per key and safe key handling.
getRandomValuesCryptographically strong random bytesUse for IVs and nonces, not Math.random().
importKeyLoad raw or structured key materialA password is not the same as a cryptographic key.
deriveKeyDerive keys from passwordsUse a proper KDF such as PBKDF2 when password-based keys are needed.
extractable: falsePrevent key exportHelpful for reducing accidental key exposure in browser code.

Reference Table Coverage

  • Browser-native hashing.
  • AES-GCM demo encryption.
  • Random IV generation.
  • Why MD5 is omitted from modern browser crypto.

API Debugging Examples

  • Generate a SHA-256 checksum for copied text.
  • Encrypt a demo message locally with AES-GCM.
  • Explain why an AES payload cannot be decrypted without IV and key metadata.

Common Mistakes

  • Treating hashes as encrypted data.
  • Reusing an AES-GCM IV with the same key.
  • Using Math.random for cryptographic values.
  • Pasting production secrets into a browser demo.

FAQ

Why does the hash tool not generate real MD5 with Web Crypto?

Web Crypto does not support MD5, and MD5 is not suitable for modern security-sensitive workflows.

Is browser encryption automatically safe?

No. The algorithm may be strong, but key management, IV uniqueness and data handling still determine safety.

What is AES-GCM good for?

AES-GCM provides authenticated encryption when used with a safe key and unique IV.