Trying to install Fedora 35 on my Acer laptop and ran into several error messages and it took a long time for the installer to boot. After waiting a while the installer bootup gave like 5 errors in a row including failing to start the window manager LXDM.
The simple fix for this was to go into the Bios and turn off Intel VTX and Intel VTD. After that the installer ran ok with no errors.
Sunday, February 20, 2022
Fedora install problems on Acer laptop
Friday, February 04, 2022
Get SHA1 using vanilla Javascript with no extra libraries
Searched this for a while and didn't find a good answer. Then finally stumbled upon someone else who pointed out that Browsers have built in crypto functions.
Here is the example code. Only works on HTTPS pages.
let message = "Test string for SHA1";
let msgUint8 = new TextEncoder().encode(message);
let hashBuffer = await crypto.subtle.digest('SHA-1', msgUint8);
let hashArray = Array.from(new Uint8Array(hashBuffer));
let sha1 = hashArray.map(b => b.toString(16).padStart(2, '0')).join('');
I tested this against PHP sha() and get the same values.
PHP :
365525a324d3c73e01574500261d5642e1b8ea33
JS:
365525a324d3c73e01574500261d5642e1b8ea33
MDN page on this:
https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto/digest
Subscribe to:
Posts (Atom)