in websockets you need to convert string to sha1 then to hex then base64 this hex
I was doing something like:
function hexEncode(str) {
var x = [];
for (var i = 0; i < str.length; i += 2) {
x.push(String.fromCharCode("0x" + str.substr(i, 2)));
}
return btoa(x.join(""));
}
Espruino is a JavaScript interpreter for low-power Microcontrollers. This site is both a support community for Espruino and a place to share what you are working on.
in websockets you need to convert string to sha1 then to hex then base64 this hex
I was doing something like: