Implemented mongoid-js for hashUtil.generate()

This commit is contained in:
Dev 2024-07-08 21:11:58 +01:00
parent a0a9b4cf29
commit 2941ae10e0
2 changed files with 3 additions and 5 deletions

View File

@ -41,6 +41,7 @@
"json-fixer": "~1.6", "json-fixer": "~1.6",
"json5": "~2.2", "json5": "~2.2",
"jsonc": "~2.0", "jsonc": "~2.0",
"mongoid-js": "~1.3",
"proper-lockfile": "~4.1", "proper-lockfile": "~4.1",
"reflect-metadata": "~0.2", "reflect-metadata": "~0.2",
"semver": "~7.6", "semver": "~7.6",

View File

@ -1,6 +1,7 @@
import crypto from "node:crypto"; import crypto from "node:crypto";
import fs from "node:fs"; import fs from "node:fs";
import crc32 from "buffer-crc32"; import crc32 from "buffer-crc32";
import { mongoid } from "mongoid-js";
import { inject, injectable } from "tsyringe"; import { inject, injectable } from "tsyringe";
import { TimeUtil } from "@spt/utils/TimeUtil"; import { TimeUtil } from "@spt/utils/TimeUtil";
@ -16,11 +17,7 @@ export class HashUtil
*/ */
public generate(): string public generate(): string
{ {
const shasum = crypto.createHash("sha256"); return mongoid();
const time = Math.random() * this.timeUtil.getTimestamp();
shasum.update(time.toString());
return shasum.digest("hex").substring(0, 24);
} }
public generateMd5ForData(data: string): string public generateMd5ForData(data: string): string