Generate a unique remote input key per connection. This closes #54

This commit is contained in:
Cameron Gutman
2016-05-09 19:19:26 -04:00
parent 83e6627025
commit e90fe56f2b
3 changed files with 37 additions and 5 deletions

View File

@@ -12,6 +12,17 @@ function uniqueid() {
});
}
function generateRemoteInputKey() {
return 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'.replace(/[x]/g, function(c) {
var r = Math.random()*16|0;
return r.toString(16);
});
}
function generateRemoteInputKeyId() {
return ((Math.random()-0.5) * 0x7FFFFFFF)|0;
}
String.prototype.toHex = function() {
var hex = '';
for(var i = 0; i < this.length; i++) {