From 9f0b255f32dfa81bffe75f89335a78a659b4ce6a Mon Sep 17 00:00:00 2001 From: TrueKuehli Date: Tue, 27 Nov 2018 12:16:33 +0100 Subject: Reworked the code, but currently unable to test, so bugs are bound to be in there Will test it sometime later. There also might still be stuff, that has yet to be reworked. --- WebInterface/NodeJSServer/src/modules/hash.js | 20 -------------------- 1 file changed, 20 deletions(-) delete mode 100644 WebInterface/NodeJSServer/src/modules/hash.js (limited to 'WebInterface/NodeJSServer/src/modules/hash.js') diff --git a/WebInterface/NodeJSServer/src/modules/hash.js b/WebInterface/NodeJSServer/src/modules/hash.js deleted file mode 100644 index 3abcc21..0000000 --- a/WebInterface/NodeJSServer/src/modules/hash.js +++ /dev/null @@ -1,20 +0,0 @@ -/** - * Creates Base64 String with SHA-256 Hash of given string - */ -String.prototype.getHash = async function() { - let data = new ArrayBuffer(this.length * 2); - let bufferView = new Uint16Array(data); - for (let i = 0; i < this.length; i++) { - bufferView[i] = this.charCodeAt(i); - } - - let encrypted = await crypto.subtle.digest('SHA-256', bufferView); - let byteArray = new Uint8Array(encrypted); - let base64String = ''; - - for (let byte of byteArray) { - base64String += String.fromCharCode(byte); - } - - return btoa(base64String); -}; -- cgit v1.2.3-54-g00ecf