sjcl.random.addEntropy():
Fixed bug: Now accepts Uint32Array for data
This commit is contained in:
parent
8bf8bbbf3c
commit
0278f2f177
@ -100,13 +100,22 @@ sjcl.random = {
|
||||
break;
|
||||
|
||||
case "object":
|
||||
if (Object.prototype.toString.call(data) !== "[object Array]") {
|
||||
err = 1;
|
||||
}
|
||||
for (i=0; i<data.length && !err; i++) {
|
||||
if (typeof(data[i]) != "number") {
|
||||
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++) {
|
||||
if (typeof(data[i]) != "number") {
|
||||
err = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!err) {
|
||||
if (estimatedEntropy === undefined) {
|
||||
|
Loading…
Reference in New Issue
Block a user