(length = 24)
| 64 | } |
| 65 | |
| 66 | function generateRandomKey(length = 24): string { |
| 67 | const chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789!@#$%^&*"; |
| 68 | const arr = crypto.getRandomValues(new Uint8Array(length)); |
| 69 | return Array.from(arr, (b) => chars[b % chars.length]).join(""); |
| 70 | } |
| 71 | export default function TextEncryption() { |
| 72 | const t = useTranslations("Tools.TextEncryption"); |
| 73 | const tc = useTranslations("ToolsConfig"); |