use xxh128 instead of xxh64
This commit is contained in:
parent
cca482079c
commit
38354be315
1 changed files with 4 additions and 3 deletions
|
@ -1,8 +1,9 @@
|
||||||
import { xxh64 } from "@node-rs/xxhash";
|
import { xxh3 } from "@node-rs/xxhash";
|
||||||
import { encode } from "html-entities";
|
import { encode } from "html-entities";
|
||||||
import { JSDOM } from "jsdom";
|
import { JSDOM } from "jsdom";
|
||||||
import util from "util";
|
import util from "util";
|
||||||
import fs from "fs";
|
import fs from "fs";
|
||||||
|
const xxh128 = xxh3.xxh128;
|
||||||
|
|
||||||
Array.prototype.random = function(){return this[Math.floor(Math.random() * this.length)]}
|
Array.prototype.random = function(){return this[Math.floor(Math.random() * this.length)]}
|
||||||
|
|
||||||
|
@ -24,7 +25,7 @@ export default function(client) {
|
||||||
|
|
||||||
client.config = {
|
client.config = {
|
||||||
get: (key) => {
|
get: (key) => {
|
||||||
var configFile = "data/" + xxh64(key).toString(16) + ".json";
|
var configFile = "data/" + xxh128(key).toString(16) + ".json";
|
||||||
var configData = {};
|
var configData = {};
|
||||||
if(fs.existsSync(configFile)) {
|
if(fs.existsSync(configFile)) {
|
||||||
configData = JSON.parse(fs.readFileSync(configFile));
|
configData = JSON.parse(fs.readFileSync(configFile));
|
||||||
|
@ -109,7 +110,7 @@ export default function(client) {
|
||||||
client.error = client.log;
|
client.error = client.log;
|
||||||
|
|
||||||
client.uploadBuffer = async function(buffer) {
|
client.uploadBuffer = async function(buffer) {
|
||||||
var hash = xxh64(buffer).toString(16);
|
var hash = xxh128(buffer).toString(16);
|
||||||
var matrixUrl = client.cache.get(hash);
|
var matrixUrl = client.cache.get(hash);
|
||||||
|
|
||||||
if(!matrixUrl) {
|
if(!matrixUrl) {
|
||||||
|
|
Loading…
Reference in a new issue