sjcl.random.addEntropy():
Fixed bug: Now accepts Uint32Array for data
This commit is contained in:
parent
8bf8bbbf3c
commit
0278f2f177
1 changed files with 14 additions and 5 deletions
|
@ -100,13 +100,22 @@ sjcl.random = {
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case "object":
|
case "object":
|
||||||
if (Object.prototype.toString.call(data) !== "[object Array]") {
|
var objName = Object.prototype.toString.call(data);
|
||||||
err = 1;
|
if (objName === "[object Uint32Array]") {
|
||||||
}
|
tmp = [];
|
||||||
for (i=0; i<data.length && !err; i++) {
|
for (i = 0; i < data.length; i++) {
|
||||||
if (typeof(data[i]) != "number") {
|
tmp.push(data[i]);
|
||||||
|
}
|
||||||
|
data = tmp;
|
||||||
|
} else {
|
||||||
|
if (objName !== "[object Array]") {
|
||||||
err = 1;
|
err = 1;
|
||||||
}
|
}
|
||||||
|
for (i=0; i<data.length && !err; i++) {
|
||||||
|
if (typeof(data[i]) != "number") {
|
||||||
|
err = 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (!err) {
|
if (!err) {
|
||||||
if (estimatedEntropy === undefined) {
|
if (estimatedEntropy === undefined) {
|
||||||
|
|
Loading…
Reference in a new issue