mirror of
https://github.com/webrecorder/pywb.git
synced 2025-03-15 00:03:28 +01:00
wombat: add check for window.crypto, generate 32-bit values
This commit is contained in:
parent
4b37d13c34
commit
d2390ee809
@ -679,11 +679,15 @@ var wombat_internal = function($wbwindow) {
|
||||
}
|
||||
|
||||
function init_crypto_random() {
|
||||
if (!$wbwindow.crypto || $wbwindow.Crypto) {
|
||||
return;
|
||||
}
|
||||
|
||||
var orig_getrandom = $wbwindow.Crypto.prototype.getRandomValues;
|
||||
|
||||
var new_getrandom = function(array) {
|
||||
for (i = 0; i < array.length; i++) {
|
||||
array[i] = parseInt(Math.random() * 65535);
|
||||
array[i] = parseInt(Math.random() * 4294967296);
|
||||
}
|
||||
return array;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user