sjcl.random.addEntropy():

Fixed bug: Now accepts Uint32Array for data
This commit is contained in:
unknown 2012-07-24 15:08:25 -05:00
parent 8bf8bbbf3c
commit 0278f2f177

View File

@ -100,7 +100,15 @@ sjcl.random = {
break;
case "object":
if (Object.prototype.toString.call(data) !== "[object Array]") {
var objName = Object.prototype.toString.call(data);
if (objName === "[object Uint32Array]") {
tmp = [];
for (i = 0; i < data.length; i++) {
tmp.push(data[i]);
}
data = tmp;
} else {
if (objName !== "[object Array]") {
err = 1;
}
for (i=0; i<data.length && !err; i++) {
@ -108,6 +116,7 @@ sjcl.random = {
err = 1;
}
}
}
if (!err) {
if (estimatedEntropy === undefined) {
/* horrible entropy estimator */