Implemented mongoid-js
for hashUtil.generate()
This commit is contained in:
parent
a0a9b4cf29
commit
2941ae10e0
@ -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",
|
||||||
|
@ -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
|
||||||
|
Loading…
x
Reference in New Issue
Block a user