Skip to content

Commit

Permalink
improve code
Browse files Browse the repository at this point in the history
Signed-off-by: Daniel Hardman <[email protected]>
  • Loading branch information
dhh1128 committed Sep 6, 2024
1 parent 208ddbf commit a0a8fb7
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion cqt.js
Original file line number Diff line number Diff line change
Expand Up @@ -98,5 +98,5 @@ function algorithm_1_14(plaintext) {
x = step5(x);

// Step 6: Convert to UTF-8 (JavaScript strings are UTF-16).
return new TextEncoder().encode(x);
return new TextEncoder('utf-8').encode(x);
}
8 changes: 4 additions & 4 deletions form.html
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,12 @@
el('sha256').value = '';
}
async function cqt() {
const utf8_canonical = algorithm_1_14(el('input').value);
const canonical = algorithm_1_14(el('input').value);
const decoder = new TextDecoder('utf-8');
el('output').value = decoder.decode(utf8Array);
const sha256 = await crypto.subtle.digest('SHA-256', utf8_canonical);
el('output').value = decoder.decode(canonical);
const sha256 = await crypto.subtle.digest('SHA-256', canonical);
el('sha256').value = hexHash(sha256);
const blake3 = await hashwasm.blake3(utf8_canonical);
const blake3 = await hashwasm.blake3(canonical);
el('blake3').value = hexHash(blake3);
}

Expand Down

0 comments on commit a0a8fb7

Please sign in to comment.