From 9efe9e6ca76461730b9e2c0aef34835052fd7c4d Mon Sep 17 00:00:00 2001 From: hirako2000 Date: Sun, 11 Feb 2018 14:36:23 +0700 Subject: [PATCH] Removes no algoritm base64 output as it now exists in encode feature - cleans up unused code --- src/routes/hash/index.js | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) diff --git a/src/routes/hash/index.js b/src/routes/hash/index.js index f072a8b..dc930ad 100644 --- a/src/routes/hash/index.js +++ b/src/routes/hash/index.js @@ -3,26 +3,19 @@ import {post, get} from 'koa-route'; import Hashes from 'jshashes'; import template from './template.marko'; -const md5 = 'MD5'; -const sha1 = 'SHA1'; -const sha256 = 'SHA256'; -const sha512 = 'SHA512'; -const ripemd = 'RIPEMD-160'; - const MD5 = new Hashes.MD5(); const SHA1 = new Hashes.SHA1(); const SHA256 = new Hashes.SHA256(); const SHA512 = new Hashes.SHA512(); const RMD160 = new Hashes.RMD160(); -app.use(get('/hash', async (ctx, next) => { +app.use(get('/hash', async ctx => { ctx.body = template.stream({ }); ctx.type = 'text/html'; })); -app.use(post('/hash', async (ctx, next) => { +app.use(post('/hash', async ctx => { const input = ctx.request.body.input; - let output; const md5Hex = MD5.hex(input); const sha1Hex = SHA1.hex(input); @@ -43,10 +36,8 @@ app.use(post('/hash', async (ctx, next) => { const sha256B64 = SHA256.b64(input); const sha512B64 = SHA512.b64(input); const rmd160B64 = RMD160.b64(input); - const noneB64 = Buffer.from(input).toString('base64'); const b64Hashes = { - none: noneB64, md5: md5B64, sha1: sha1B64, sha256: sha256B64,