const crypto = typeof window !== 'undefined' ? window.crypto : require('node:crypto'); export const generate64ByteHash = async (content: any) => { const data = typeof window !== 'undefined' ? new TextEncoder().encode(content) : Buffer.from(content); const hashBuffer = await (crypto.subtle ? crypto.subtle.digest('SHA-256', data) : crypto.createHash('sha256').update(data).digest()); const hashArray = Array.from(new Uint8Array(hashBuffer)); const hashHex = hashArray.map(b => b.toString(16).padStart(2, '0')).join(''); return hashHex; }