Skip to content

Commit

Permalink
feat: js-md5 migrated to native solution
Browse files Browse the repository at this point in the history
  • Loading branch information
pigri committed Mar 17, 2024
1 parent 7771d69 commit 954b815
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 14 deletions.
3 changes: 1 addition & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "cf-workers-hash",
"version": "1.0.2",
"version": "1.0.3",
"description": "A simple hash function for Cloudflare Workers",
"main": "./dist/index.js",
"module": "./dist/index.mjs",
Expand Down Expand Up @@ -59,7 +59,6 @@
"@aws-crypto/crc32": "5.2.0",
"@aws-crypto/crc32c": "5.2.0",
"bcryptjs": "2.4.3",
"js-md5": "0.8.3",
"js-sha3": "0.9.3",
"md6-hash": "1.0.0",
"whirlpool-hash": "1.1.6",
Expand Down
7 changes: 0 additions & 7 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 1 addition & 5 deletions src/index.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
/* @typescript-eslint/no-unused-functions */

import * as bcryptjs from 'bcryptjs';
import * as md5js from 'js-md5';
import * as xxh from 'xxhashjs';
import * as whirlpooljs from 'whirlpool-hash';
import * as sha3 from 'js-sha3';
Expand All @@ -19,10 +18,6 @@ function cryptoHasher(hashType: string) {
};
}

export function md5(input: string): Promise<string> {
return Promise.resolve(md5js.md5(input));
}

export function base64(input: string): Promise<string> {
return Promise.resolve(btoa(input));
}
Expand All @@ -35,6 +30,7 @@ export const sha1 = cryptoHasher('SHA-1');
export const sha256 = cryptoHasher('SHA-256');
export const sha384 = cryptoHasher('SHA-384');
export const sha512 = cryptoHasher('SHA-512');
export const md5 = cryptoHasher('MD5');

export async function bcrypt(input: string, saltRounds: number): Promise<string> {
const salt = await bcryptjs.genSalt(saltRounds);
Expand Down

0 comments on commit 954b815

Please sign in to comment.