summaryrefslogtreecommitdiff
path: root/WebInterface/NodeJSServer/src/modules/hash.js
blob: 29be0afc07a9417561acd9f61862c1b063fda64d (plain)
1
2
3
4
5
6
7
8
9
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);
  }

  return await crypto.subtle.digest('SHA-256', bufferView);
}