Skip to content

Commit

Permalink
Added comments
Browse files Browse the repository at this point in the history
  • Loading branch information
Manan committed Aug 14, 2024
1 parent 8067657 commit 2b2377b
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion modules/symitriDapRtdProvider.js
Original file line number Diff line number Diff line change
Expand Up @@ -527,12 +527,15 @@ export function createRtdProvider(moduleName, moduleCode, headerPrefix) {

addIdentifier: function(identity, apiParams) {
if (typeof (identity.value) != typeof (undefined) && identity.value.trim() !== '') {
let hid = this.generateHash(identity.value);
let hid = this.generateHash(identity.value); //Hash the identifier passed by Publisher through config
apiParams.identity = hid;
}
return apiParams;
},

//Using custom SHA256 algorithm to synchronously generate hash for the identifier as we can't use asynchronous crypto.subtle.digest.
//Copyright 2022 Andrea Griffini
//https://github.com/6502/sha256/
generateHash: function(message) {
const data = new TextEncoder().encode(message);
let h0 = 0x6a09e667; let h1 = 0xbb67ae85; let h2 = 0x3c6ef372; let h3 = 0xa54ff53a;
Expand Down

0 comments on commit 2b2377b

Please sign in to comment.