mirror of
https://github.com/th-ch/youtube-music.git
synced 2026-01-12 19:01:47 +00:00
8 lines
260 B
TypeScript
8 lines
260 B
TypeScript
export const SHA1Hash = async (str: string) => {
|
|
const enc = new TextEncoder();
|
|
const hash = await crypto.subtle.digest('SHA-1', enc.encode(str));
|
|
return Array.from(new Uint8Array(hash))
|
|
.map((v) => v.toString(16).padStart(2, '0'))
|
|
.join('');
|
|
};
|