Files
fibonacci-fold/src/utils/crypto.js
2024-09-09 07:44:04 -04:00

10 lines
293 B
JavaScript

import { v4 as uuidv4 } from 'uuid';
import CryptoJS from 'crypto-js';
// Generate a session ID hash
export const generateUniqueId = () => {
const uuid = uuidv4();
const hash = CryptoJS.SHA256(uuid).toString();
return hash.substring(0, 28); // Use the first 8 characters of the hash
};