Migrate project from typing_practiceweb

This commit is contained in:
2026-05-14 16:04:14 +08:00
parent dbc5425706
commit 0e87d5546d
225 changed files with 92811 additions and 0 deletions

13
server/utils/crypto.ts Normal file
View File

@@ -0,0 +1,13 @@
import crypto from 'crypto';
/**
* 生成指定长度的随机字符串
* @param length 要生成的字符串长度
* @returns 随机字符串
*/
export function generateRandomString(length: number): string {
return crypto
.randomBytes(Math.ceil(length / 2))
.toString('hex')
.slice(0, length);
}