From 40c1c56d95d83c3ab7e22f46cc652fc39bfd1cf1 Mon Sep 17 00:00:00 2001 From: librelois <elois@ifee.fr> Date: Fri, 3 Apr 2020 01:45:27 +0200 Subject: [PATCH] [ref] sha256: use duniteroxyde to compute sha256 hash --- app/lib/common.ts | 10 +++------- package.json | 2 +- yarn.lock | 8 ++++---- 3 files changed, 8 insertions(+), 12 deletions(-) diff --git a/app/lib/common.ts b/app/lib/common.ts index aecb52f0e..8501d067a 100644 --- a/app/lib/common.ts +++ b/app/lib/common.ts @@ -11,12 +11,8 @@ // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. -import * as crypto from 'crypto' +import {sha256} from 'duniteroxyde' -export const hashf = function hashf(str:string) { - return crypto - .createHash("sha256") - .update(str) - .digest("hex") - .toUpperCase() +export const hashf = function hashf(str:string) { + return sha256(str) } diff --git a/package.json b/package.json index 21a186cad..fcd1261dc 100644 --- a/package.json +++ b/package.json @@ -71,7 +71,7 @@ "cors": "2.8.2", "daemonize2": "0.4.2", "ddos": "0.1.16", - "duniteroxyde": "0.1.0", + "duniteroxyde": "0.2.0", "errorhandler": "1.5.0", "event-stream": "3.3.4", "express": "4.15.2", diff --git a/yarn.lock b/yarn.lock index bb70a6a16..e92dd7d2d 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1495,10 +1495,10 @@ doctrine@^2.1.0: dependencies: esutils "^2.0.2" -duniteroxyde@0.1.0: - version "0.1.0" - resolved "https://registry.yarnpkg.com/duniteroxyde/-/duniteroxyde-0.1.0.tgz#acc06fb7ac6e269a5d8b25f09c5d48088a087917" - integrity sha512-EDfxKlVhJrUyuWd9gBNHC1wrQ6Zc6z5JYR1LQf4yhW6N/LNPzM3S0uI95gWeSyNqwSlIiLiIOMoRxJenozqH4g== +duniteroxyde@0.2.0: + version "0.2.0" + resolved "https://registry.yarnpkg.com/duniteroxyde/-/duniteroxyde-0.2.0.tgz#5f84de3f92e91c5c65406c710a36dd47d2bde4b0" + integrity sha512-jMOD74/ajxn8sOHaCUzQ1wgoKcLBTpHeCdMGolqJxRoA+22fQdoQFJvUbRBo/T50sjcHvF51TPofig1S0Gg+6w== dependencies: neon-cli "^0.4.0" -- GitLab