From 3a3d0fc3d4733f8908e23a03f860d76340479ec4 Mon Sep 17 00:00:00 2001 From: Dennis Kobert Date: Tue, 11 Jun 2019 23:53:30 +0200 Subject: Reorganize Project structure --- .../NodeJSServer/src/js/modules/networking/hash.js | 20 -------------------- 1 file changed, 20 deletions(-) delete mode 100644 WebInterface/NodeJSServer/src/js/modules/networking/hash.js (limited to 'WebInterface/NodeJSServer/src/js/modules/networking/hash.js') diff --git a/WebInterface/NodeJSServer/src/js/modules/networking/hash.js b/WebInterface/NodeJSServer/src/js/modules/networking/hash.js deleted file mode 100644 index 3abcc21..0000000 --- a/WebInterface/NodeJSServer/src/js/modules/networking/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-70-g09d2