Use all the possible values for a unicode mapping
This commit is contained in:
parent
caae505777
commit
876e6d9015
@ -9,6 +9,7 @@ let usingUnicode = function(result){
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
let doUnicode = browser.storage.sync.get("keyboardprivacyunicode");
|
||||
doUnicode.then(usingUnicode, onError);
|
||||
|
||||
|
@ -1,3 +1,16 @@
|
||||
let randNum = function(minValue, maxValue){
|
||||
let buf = new Uint8Array(1)
|
||||
while (true){
|
||||
window.crypto.getRandomValues(buf);
|
||||
|
||||
if (buf[0] <= maxValue && buf[0] >= minValue){
|
||||
break;
|
||||
}
|
||||
buf = new Uint8Array(1);
|
||||
}
|
||||
return buf[0];
|
||||
}
|
||||
|
||||
let getUnicode = function(input){
|
||||
const uc =
|
||||
{
|
||||
@ -103,8 +116,8 @@ let getUnicode = function(input){
|
||||
output += element
|
||||
}
|
||||
else{
|
||||
output += uc[element][0]
|
||||
output += uc[element][randNum(0, uc[element].length - 1)]
|
||||
}
|
||||
})
|
||||
return output
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user