@mui/x-telemetry
Version:
MUI X Telemetry.
12 lines (11 loc) • 390 B
JavaScript
;
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.hashString = hashString;
async function hashString(str) {
const data = new TextEncoder().encode(str);
const hashBuffer = await crypto.subtle.digest('SHA-256', data);
const hashArray = Array.from(new Uint8Array(hashBuffer));
return hashArray.map(b => b.toString(16).padStart(2, '0')).join('');
}