This commit is contained in:
2025-02-13 12:12:19 -06:00
parent d6aa54e040
commit 1fe2472a51
3 changed files with 7 additions and 7 deletions

View File

@@ -42,7 +42,7 @@
}, },
"dependencies": { "dependencies": {
"@stablelib/xchacha20poly1305": "^1.0.1", "@stablelib/xchacha20poly1305": "^1.0.1",
"blake2": "^5.0.0", "blake2b": "^2.1.4",
"int64-buffer": "^1.0.0", "int64-buffer": "^1.0.0",
"text-encoding": "^0.7.0", "text-encoding": "^0.7.0",
"uuid": "^8.3.2" "uuid": "^8.3.2"

View File

@@ -1,4 +1,4 @@
import blake2 from 'blake2'; import blake2b from 'blake2b';
import fs from 'fs'; import fs from 'fs';
import { Uint64BE } from 'int64-buffer'; import { Uint64BE } from 'int64-buffer';
@@ -6,12 +6,12 @@ import * as repertory from '../index.js';
import connection from '../networking/connection'; import connection from '../networking/connection';
const TEST_HOST = process.env.TEST_HOST || 'localhost'; const TEST_HOST = process.env.TEST_HOST || 'localhost';
const TEST_PASSWORD = process.env.TEST_PASSWORD || ''; const TEST_PASSWORD = process.env.TEST_PASSWORD || 'cow_moose_doge_chicken';
const TEST_PORT = process.env.TEST_PORT || 20000; const TEST_PORT = process.env.TEST_PORT || 20000;
const calculate_sha256 = (path) => { const calculate_sha256 = (path) => {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
const hash = blake2.createHash('blake2b', { digestLength: 32 }); const hash = blake2b(32);
fs.createReadStream(path) fs.createReadStream(path)
.on('data', (data) => hash.update(data)) .on('data', (data) => hash.update(data))

View File

@@ -1,6 +1,6 @@
import { randomBytes } from 'crypto'; import { randomBytes } from 'crypto';
import { Int64BE, Uint64BE } from 'int64-buffer'; import { Int64BE, Uint64BE } from 'int64-buffer';
import blake2 from 'blake2'; import blake2b from 'blake2b';
import { TextEncoder } from 'text-encoding'; import { TextEncoder } from 'text-encoding';
import { getCustomEncryption } from '../utils/constants'; import { getCustomEncryption } from '../utils/constants';
import { import {
@@ -156,7 +156,7 @@ export default class packet {
decrypt = async () => { decrypt = async () => {
try { try {
let hash = blake2.createHash('blake2b', { digestLength: 32 }); let hash = blake2b(32);
hash = hash.update(new TextEncoder().encode(this.token)); hash = hash.update(new TextEncoder().encode(this.token));
const key = Uint8Array.from(hash.digest()); const key = Uint8Array.from(hash.digest());
@@ -282,7 +282,7 @@ export default class packet {
encrypt = async (nonce) => { encrypt = async (nonce) => {
try { try {
let hash = blake2.createHash('blake2b', { digestLength: 32 }); let hash = blake2b(32);
hash = hash.update(new TextEncoder().encode(this.token)); hash = hash.update(new TextEncoder().encode(this.token));
const key = Uint8Array.from(hash.digest()); const key = Uint8Array.from(hash.digest());