Crypto
MDN Web Docs · نسخهٔ df622a2a1c1e · CC BY-SA 2.5 و مجوز جداگانهٔ ناشر برای نمونهکد
{{APIRef("Web Crypto API")}}{{AvailableInWorkers}}
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.
The Crypto is available in windows using the {{domxref("Window.crypto")}} property and in workers using the {{domxref("WorkerGlobalScope.crypto")}} property.
Instance properties
- {{domxref("Crypto.subtle")}} {{ReadOnlyInline}} {{SecureContext_inline}}
- : Returns a {{domxref("SubtleCrypto")}} object providing access to common cryptographic primitives, like hashing, signing, encryption, or decryption.
Instance methods
- {{domxref("Crypto.getRandomValues()")}}
- : Fills the passed {{ jsxref("TypedArray") }} with cryptographically sound random values.
- {{domxref("Crypto.randomUUID()")}} {{SecureContext_inline}}
- : Returns a randomly generated, 36 character long v4 UUID.
Specifications
{{Specifications}}
Browser compatibility
{{Compat}}
See also
- Web security
- Secure contexts
- Features restricted to secure contexts
- Transport Layer Security
- Strict-Transport-Security