perf(bundle): create-hash -> crypto-js

This commit is contained in:
rusconn
2024-09-19 04:36:41 +09:00
parent ddaed4a08b
commit 1e9e507912
3 changed files with 22 additions and 66 deletions

View File

@@ -1,7 +1,10 @@
"use client";
import { useCallback, useState } from "react";
import createHash from "create-hash";
import MD5 from "crypto-js/md5";
import SHA1 from "crypto-js/sha1";
import SHA256 from "crypto-js/sha256";
import SHA512 from "crypto-js/sha512";
import { toolGroups } from "@/config/tools";
import { Input } from "@/components/ui/input";
@@ -19,10 +22,10 @@ export default function Page() {
const [uppercase, setUppercase] = useState(false);
const [input, setInput] = useState("Hello there !");
const newMd5 = createHash("md5").update(input).digest("hex");
const newSha1 = createHash("sha1").update(input).digest("hex");
const newSha256 = createHash("sha256").update(input).digest("hex");
const newSha512 = createHash("sha512").update(input).digest("hex");
const newMd5 = MD5(input).toString();
const newSha1 = SHA1(input).toString();
const newSha256 = SHA256(input).toString();
const newSha512 = SHA512(input).toString();
const md5 = uppercase ? newMd5.toUpperCase() : newMd5;
const sha1 = uppercase ? newSha1.toUpperCase() : newSha1;