-
+
LMTLab
-
+
+ { currModule }
+
+
+
+
diff --git a/app/globals.css b/app/globals.css
index f3bd93b..d8ee889 100644
--- a/app/globals.css
+++ b/app/globals.css
@@ -2,6 +2,10 @@
@tailwind components;
@tailwind utilities;
+.text-weak {
+ @apply text-zinc-500 dark:text-zinc-400;
+}
+
html.light {
--background: #ffffff;
--foreground: #171717;
diff --git a/app/page.tsx b/app/page.tsx
index adbb039..25259d8 100644
--- a/app/page.tsx
+++ b/app/page.tsx
@@ -1,13 +1,7 @@
import { Card, CardBody } from '@nextui-org/card';
import Link from 'next/link';
+import { urlList } from '@/app/urlList';
-const urlList = [
- {
- name: 'Json Parser',
- desc: 'Parse a Json file, with formatter and syntax highlighting',
- url: '/jsonparser'
- }
-];
export default function Home() {
diff --git a/app/strcoder/algorithms.ts b/app/strcoder/algorithms.ts
new file mode 100644
index 0000000..7b928f2
--- /dev/null
+++ b/app/strcoder/algorithms.ts
@@ -0,0 +1,56 @@
+import { enc, MD5, SHA1, SHA256, SHA512 } from 'crypto-js';
+
+export const hashAlgorithms = {
+ 'SHA-1': (input: string) => {
+ return SHA1(input);
+ },
+ 'SHA-256': (input: string) => {
+ return SHA256(input);
+ },
+ 'SHA-512': (input: string) => {
+ return SHA512(input);
+ },
+ 'MD5': (input: string) => {
+ return MD5(input);
+ }
+};
+
+export const encodeAlgorithms = {
+ 'Base64': (input: string) => {
+ const wordArray = enc.Utf8.parse(input);
+ return enc.Base64.stringify(wordArray);
+ },
+ 'URI': (input: string) => {
+ return encodeURI(input).toString();
+ },
+ 'URI Component': (input: string) => {
+ return encodeURIComponent(input).toString();
+ }
+};
+
+export const decodeAlgorithms = {
+ 'Base64': (input: string) => {
+ return enc.Base64.parse(input).toString(enc.Utf8);
+ },
+ 'URI': (input: string) => {
+ return decodeURI(input).toString();
+ },
+ 'URI Component': (input: string) => {
+ return decodeURIComponent(input).toString();
+ }
+};
+
+export const algorithms = {
+ 'hash': {
+ list: hashAlgorithms,
+ color: 'primary'
+ },
+ 'encode': {
+ list: encodeAlgorithms,
+ color: 'secondary'
+ },
+ 'decode': {
+ list: decodeAlgorithms,
+ color: 'success'
+ }
+};
diff --git a/app/strcoder/page.tsx b/app/strcoder/page.tsx
new file mode 100644
index 0000000..e4ba894
--- /dev/null
+++ b/app/strcoder/page.tsx
@@ -0,0 +1,127 @@
+'use client';
+
+import React, { useState } from 'react';
+import { Button, Textarea } from '@nextui-org/react';
+import { toast } from 'react-toastify';
+import { HiOutlineBackspace, HiOutlineDuplicate } from 'react-icons/hi';
+import { algorithms } from '@/app/strcoder/algorithms';
+import { useTheme } from 'next-themes';
+
+type ButtonColor = 'primary' | 'secondary' | 'success' | 'default' | 'warning' | 'danger' | undefined;
+
+const Page = () => {
+ const [ input, setInput ] = useState('');
+ const [ output, setOutput ] = useState('');
+ const { theme } = useTheme();
+ return (
+ <>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ >
+ );
+};
+export default Page;
diff --git a/app/urlList.ts b/app/urlList.ts
new file mode 100644
index 0000000..7d668ff
--- /dev/null
+++ b/app/urlList.ts
@@ -0,0 +1,12 @@
+export const urlList = [
+ {
+ name: 'Json Parser',
+ desc: 'Parse a Json file, with formatter and syntax highlighting',
+ url: '/jsonparser'
+ },
+ {
+ name: 'String Coder',
+ desc: 'String encoding & decoding, hashing',
+ url: '/strcoder'
+ }
+];
diff --git a/package.json b/package.json
index 55cc1b3..43cf597 100644
--- a/package.json
+++ b/package.json
@@ -11,6 +11,7 @@
"dependencies": {
"@monaco-editor/react": "^4.6.0",
"@nextui-org/react": "^2.4.8",
+ "crypto-js": "^4.2.0",
"framer-motion": "^11.11.0",
"next": "14.2.14",
"next-themes": "^0.3.0",
@@ -20,6 +21,7 @@
"react-toastify": "^10.0.6"
},
"devDependencies": {
+ "@types/crypto-js": "^4.2.2",
"@types/node": "^20",
"@types/react": "^18",
"@types/react-dom": "^18",