1
0
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:
Ilya Kreymer 2016-03-20 22:43:05 -07:00
parent 4b37d13c34
commit d2390ee809

View File

@ -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;
}