1
0
mirror of https://github.com/matrix-org/matrix-react-sdk.git synced 2025-11-08 21:42:24 +03:00

Add tip about shasum

This commit is contained in:
James Salter
2021-07-21 18:25:05 +01:00
parent 0c89eb51d4
commit 585b702652

View File

@@ -40,6 +40,8 @@ export interface IWelcomeScreenLoad extends IAnonymousEvent {
} }
const hashHex = async (input: string): Promise<string> => { const hashHex = async (input: string): Promise<string> => {
// on os x (e.g. if you want to know the sha-256 of your own matrix ID so you can look it up):
// echo -n <input> | shasum -a 256
const buf = new TextEncoder().encode(input); const buf = new TextEncoder().encode(input);
const digestBuf = await window.crypto.subtle.digest("sha-256", buf); const digestBuf = await window.crypto.subtle.digest("sha-256", buf);
return [...new Uint8Array(digestBuf)].map((b: number) => b.toString(16).padStart(2, "0")).join(""); return [...new Uint8Array(digestBuf)].map((b: number) => b.toString(16).padStart(2, "0")).join("");