mirror of
https://github.com/ershisan99/DevToysWeb.git
synced 2025-12-18 04:59:23 +00:00
perf(bundle): create-hash -> crypto-js
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user