diff options
author | Dennis Kobert <d-kobert@web.de> | 2019-06-12 21:51:39 +0200 |
---|---|---|
committer | Dennis Kobert <d-kobert@web.de> | 2019-06-12 21:51:39 +0200 |
commit | 9e9c1c822a64c0a65033b7eed07ea661a385cecc (patch) | |
tree | ee699d4e93bb4204f5f4e04cd14f6d77365b81b4 /WebInterface/NodeJSServer/src/js/modules/networking/hash.js | |
parent | 304437b834e8c87687f68333ae67a13ee1377a73 (diff) | |
parent | 3a3d0fc3d4733f8908e23a03f860d76340479ec4 (diff) |
Merge remote-tracking branch 'origin/master'
Diffstat (limited to 'WebInterface/NodeJSServer/src/js/modules/networking/hash.js')
-rw-r--r-- | WebInterface/NodeJSServer/src/js/modules/networking/hash.js | 20 |
1 files changed, 0 insertions, 20 deletions
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); -}; |