|
发表于 2021-10-11 11:14:17
|
显示全部楼层
广东省广州市
本帖最后由 落枫_rain 于 2021-10-11 11:30 编辑
window.crypto.getRandomValues = function(array){
if (array === undefined)throw new TypeError("Failed to execute 'getRandomValues' on 'Crypto': 1 argument required, but only 0 present.");
if (array.constructor.name === "Uint8Array" && array.length > 65536)throw new DOMException("Failed to execute 'getRandomValues' on 'Crypto': The ArrayBufferView's byte length (".concat(array.length) + ") exceeds the number of bytes of entropy available via this API (65536).","QuotaExceededError",22);
if (array.constructor.name === "Uint16Array" && array.length > 32768)throw new DOMException("Failed to execute 'getRandomValues' on 'Crypto': The ArrayBufferView's byte length (".concat(array.length*2) + ") exceeds the number of bytes of entropy available via this API (65536).","QuotaExceededError",22);
if (array.constructor.name === "Uint32Array" && array.length > 16384)throw new DOMException("Failed to execute 'getRandomValues' on 'Crypto': The ArrayBufferView's byte length (".concat(array.length*4) + ") exceeds the number of bytes of entropy available via this API (65536).","QuotaExceededError",22);
if (array.constructor.name === "Uint8ClampedArray" && array.length > 65536)throw new DOMException("Failed to execute 'getRandomValues' on 'Crypto': The ArrayBufferView's byte length (".concat(array.length) + ") exceeds the number of bytes of entropy available via this API (65536).","QuotaExceededError",22);
for (let key in array){
array[key] = Math.random()*100000000;
}
}
|
|