W3C home > Mailing lists > Public > whatwg@whatwg.org > February 2011

[whatwg] Cryptographically strong random numbers

From: Allen Wirfs-Brock <allen@wirfs-brock.com>
Date: Wed, 16 Feb 2011 17:33:44 -0800
Message-ID: <7A9882AF-8CE2-4EF0-84AC-F6547BDC80CA@wirfs-brock.com>

On Feb 16, 2011, at 4:54 PM, David Herman wrote:

> I say: let's make it typed array in the short term, but TC39 will spec it as an array of uint32 according to the binary data spec. We will try to make the binary data spec as backwards compatible as possible with typed arrays anyway. So in the near term, implementors can use typed arrays, but when they have implementations of the full binary data spec, they can change to use those. It'll probably be a slightly backwards-incompatible change, but by keeping them relatively API-compatible, it shouldn't make too much difference in practice. Plus we can warn people that that change is coming.

Dave, most browsers other than FF4 internally box all  integers with with 32-significant bits.  Some may box with 31 or even 30 significant bits.  So if we spec. the value as a  uint32 and (they are truly random enough) then at least half and possible 75% or more of the values in the array will be boxed in many browsers.  Such boxing will have a much higher cost than immediate uint16 values.  That's why I propose 16-bit values.

Allen
Received on Wednesday, 16 February 2011 17:33:44 UTC

This archive was generated by hypermail 2.3.1 : Monday, 13 April 2015 23:09:04 UTC