--- title: Crypto slug: Web/API/Crypto tags: - API - Interface - NeedsTranslation - Reference - TopicStub - Web Crypto API translation_of: Web/API/Crypto ---

{{APIRef("Web Crypto API")}}

The Crypto interface represents basic cryptography features available in the current context. It allows access to a cryptographically strong random number generator and to cryptographic primitives.

An object with this interface is available on Web context via the {{domxref("Window.crypto")}} property.

Properties

This interface implements properties defined on {{domxref("RandomSource")}}.

{{domxref("Crypto.subtle")}} {{experimental_inline}}{{readOnlyInline}}
Returns a {{domxref("SubtleCrypto")}} object providing access to common cryptographic primitives, like hashing, signing, encryption or decryption.

Methods

This interface implements methods defined on {{domxref("RandomSource")}}.

{{domxref("Crypto.getRandomValues()")}}
Fills the passed {{ jsxref("TypedArray") }} with cryptographically sound random values.

Specifications

Specification Status Comment
{{SpecName("Web Crypto API", "#crypto-interface", "Crypto")}} {{Spec2("Web Crypto API")}} Initial definition

Browser Compatibility

{{Compat("api.Crypto")}}

See Also