https://wiki.whatwg.org/api.php?action=feedcontributions&user=BrendanEich&feedformat=atomWHATWG Wiki - User contributions [en]2024-03-19T11:29:29ZUser contributionsMediaWiki 1.39.3https://wiki.whatwg.org/index.php?title=Crypto&diff=6458Crypto2011-05-25T21:44:11Z<p>BrendanEich: fix typo</p>
<hr />
<div>=Overview=<br />
<br />
This document describes a proposal for the window.crypto API.<br />
<br />
=Definitions=<br />
<br />
==Cryptographically Random Values==<br />
<br />
A ''cryptographically random value'' is a value generated from a cryptographically strong pseudo-random number generator seeded with truly random values. In practice, implementations should generate cryptographically random values using well-established cryptographic pseudo-random number generators, such as RC4, seeded with high-quality entropy, such as from an operating-system entropy source (e.g., ''/dev/urandom''). This document provides no lower-bound on the information theoretic entropy present in cryptographically random values, but implementations should make a best effort to provide as much entropy as practicable.<br />
<br />
=Interface=<br />
<br />
<pre><br />
[NoInterfaceObject]<br />
interface Crypto {<br />
void getRandomValues(in ArrayBufferView array);<br />
};<br />
<br />
[Supplemental, NoInterfaceObject]<br />
interface Window {<br />
readonly attribute Crypto crypto;<br />
};<br />
</pre><br />
<br />
=Methods=<br />
<br />
==getRandomValues==<br />
<br />
The ''getRandomValues'' method fills ''array'' with random data. Specifically, if ''array'' is an [http://www.khronos.org/registry/typedarray/specs/latest/#6 ArrayBufferView] of an integer type (i.e., Int8Array, Uint8Array, Int16Array, Uint16Array, Int32Array, or Uint32Array), then all the elements of ''array'' are overwritten with ''cryptographically random values'' of the appropriate type. If ''array'' is not of an integer type, ''getRandomValues'' throws a [http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html#dom-domexception-type_mismatch_err TYPE_MISMATCH_ERR].<br />
<br />
[[Category:Proposals]]</div>BrendanEich