@ende/crypto/crypto

ende add jsr:@ende/crypto

Version 2026.10.15 on JSR.

Extensions to the Web Crypto API supporting additional encryption APIs, but also delegating to the built-in APIs when possible.

Provides additional digest algorithms that are not part of the WebCrypto standard as well as a subtle.digest and subtle.digestSync methods.

The KeyStack export implements the KeyRing interface for managing rotatable keys for signing data to prevent tampering, like with HTTP cookies.

Supported algorithms

Here is a list of supported algorithms. If the algorithm name in WebCrypto and Wasm/Rust is the same, this library prefers to use the implementation provided by WebCrypto.

Length-adjustable algorithms support the DigestAlgorithmObject.length option.

WebCrypto:

  • SHA-384
  • SHA-256 (length-extendable)
  • SHA-512 (length-extendable)

Wasm/Rust:

  • BLAKE2B
  • BLAKE2B-128
  • BLAKE2B-160
  • BLAKE2B-224
  • BLAKE2B-256
  • BLAKE2B-384
  • BLAKE2S
  • BLAKE3 (length-adjustable)
  • KECCAK-224
  • KECCAK-256
  • KECCAK-384
  • KECCAK-512
  • SHA-384
  • SHA3-224
  • SHA3-256
  • SHA3-384
  • SHA3-512
  • SHAKE128 (length-adjustable)
  • SHAKE256 (length-adjustable)
  • TIGER
  • RIPEMD-160 (length-extendable)
  • SHA-224 (length-extendable)
  • SHA-256 (length-extendable)
  • SHA-512 (length-extendable)
  • MD4 (length-extendable and collidable)
  • MD5 (length-extendable and collidable)
  • SHA-1 (length-extendable and collidable)
  • FNV32 (non-cryptographic)
  • FNV32A (non-cryptographic)
  • FNV64 (non-cryptographic)
  • FNV64A (non-cryptographic)

Exports

  • crypto — A wrapper for WebCrypto which adds support for additional non-standard algorithms, but delegates to the runtime WebCrypto implementation whenever possible.
  • DIGEST_ALGORITHM_NAMES — All cryptographic hash/digest algorithms supported by std/crypto.
  • DigestAlgorithm — Extended digest algorithms accepted by stdCrypto.subtle.digest.
  • DigestAlgorithmName — An algorithm name supported by std/crypto.
  • DigestAlgorithmObject — Extended digest algorithm objects.
  • StdCrypto — Extensions to the Web Crypto interface.
  • StdSubtleCrypto — Extensions to the web standard `SubtleCrypto` interface.