Skip to content

Commit

Permalink
Removes no algoritm base64 output as it now exists in encode feature …
Browse files Browse the repository at this point in the history
…- cleans up unused code
  • Loading branch information
hirako2000 committed Feb 11, 2018
1 parent 0418a71 commit 9efe9e6
Showing 1 changed file with 2 additions and 11 deletions.
13 changes: 2 additions & 11 deletions src/routes/hash/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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,
Expand Down

0 comments on commit 9efe9e6

Please sign in to comment.