-
-
-
+
+
+
- {plainText ? (
-
- ) : (
-
- )}
+
-
-
-
-
-
-
-
-
-
+
+
+
+
- {cipherText &&
Encrypted Text: {cipherText}
}
+ {outputText && (
+
+ {mode === "encrypt" ? "Encrypted Text:" : "Decrypted Text:"}{" "}
+ {outputText}
+
+ )}
- {decryptedText &&
Decrypted Text: {decryptedText}
}
-
-
-
);
}
diff --git a/fairplay/src/components/FiveFiveDynamic/FiveFiveDynamic.jsx b/fairplay/src/components/FiveFiveDynamic/FiveFiveDynamic.jsx
index a1c7d58..6710aba 100644
--- a/fairplay/src/components/FiveFiveDynamic/FiveFiveDynamic.jsx
+++ b/fairplay/src/components/FiveFiveDynamic/FiveFiveDynamic.jsx
@@ -102,7 +102,7 @@ const FiveFiveDynamic = () => {
setInputString("");
setSubstrings([]);
setEncryptedSubstrings([]);
- setFlag(flag === 1);
+ setFlag((flag = 1));
};
// Function to filter the input string
diff --git a/fairplay/src/components/FiveFiveDynamic/FiveFiveDynamic.module.css b/fairplay/src/components/FiveFiveDynamic/FiveFiveDynamic.module.css
index 428755a..19d9dae 100644
--- a/fairplay/src/components/FiveFiveDynamic/FiveFiveDynamic.module.css
+++ b/fairplay/src/components/FiveFiveDynamic/FiveFiveDynamic.module.css
@@ -27,18 +27,15 @@
padding: 0;
margin: 0;
transition: all 0.3s ease;
-
- border: 2px solid #000;
}
.inputbox {
-
- /* Container styles */
- margin: 20px;
- padding: 20px;
- border: 1px solid #bca1a1;
- border-radius: 5px;
- background-color: rgba(89, 75, 61,0.8);
+ /* Container styles */
+ margin: 20px;
+ padding: 20px;
+ border: 1px solid #bca1a1;
+ border-radius: 5px;
+ background-color: rgba(89, 75, 61, 0.8);
}
.inputbox label {
@@ -89,17 +86,15 @@
}
.move_button {
-
- /* Button styles */
- padding: 10px 20px;
- margin: 0 10px; /* Add space between buttons */
- background-color: rgba(210, 183, 150,0.7); /* Blue color */
- color: #fff; /* White text color */
- border: none;
- border-radius: 4px;
- cursor: pointer;
- transition: background-color 0.3s ease;
-
+ /* Button styles */
+ padding: 10px 20px;
+ margin: 0 10px; /* Add space between buttons */
+ background-color: rgba(210, 183, 150, 0.7); /* Blue color */
+ color: #fff; /* White text color */
+ border: none;
+ border-radius: 4px;
+ cursor: pointer;
+ transition: background-color 0.3s ease;
}
.move_button:hover {
diff --git a/fairplay/src/components/FiveFiveHighlight/FiveFiveHighlight.module.css b/fairplay/src/components/FiveFiveHighlight/FiveFiveHighlight.module.css
index dc43797..cacad93 100644
--- a/fairplay/src/components/FiveFiveHighlight/FiveFiveHighlight.module.css
+++ b/fairplay/src/components/FiveFiveHighlight/FiveFiveHighlight.module.css
@@ -15,8 +15,8 @@
align-items: center;
}
-.box p{
-
+.box p {
+ font-size: 30px;
}
.box:hover {
@@ -32,9 +32,13 @@
.row {
display: flex;
flex-direction: row;
-
}
.highlight {
- background-color: rgba(202, 160, 85,0.5); /* Change highlight color as needed */
+ background-color: rgba(
+ 202,
+ 160,
+ 85,
+ 0.5
+ ); /* Change highlight color as needed */
}
diff --git a/fairplay/src/components/FiveFiveStatic/FiveFiveStatic.jsx b/fairplay/src/components/FiveFiveStatic/FiveFiveStatic.jsx
index 4282077..75022a5 100644
--- a/fairplay/src/components/FiveFiveStatic/FiveFiveStatic.jsx
+++ b/fairplay/src/components/FiveFiveStatic/FiveFiveStatic.jsx
@@ -2,99 +2,97 @@ import React, { useEffect } from "react";
import styles from "./FiveFiveStatic.module.css"; // Import the CSS module
const FiveFiveStatic = ({ cipherText }) => {
+ const matrix5x5 = [
+ [1, 2, 3, 4, 5],
+ [6, 7, 8, 9, 10],
+ [11, 12, 13, 14, 15],
+ [16, 17, 18, 19, 20],
+ [21, 22, 23, 24, 25],
+ ];
- const matrix5x5 = [
- [1, 2, 3, 4, 5],
- [6, 7, 8, 9, 10],
- [11, 12, 13, 14, 15],
- [16, 17, 18, 19, 20],
- [21, 22, 23, 24, 25]
- ];
+ // Convert the cipher text to uppercase and replace 'J' with 'I'
+ let modifiedCipherText = cipherText
+ .toUpperCase()
+ .replace(/J/g, "I")
+ .replace(/[^A-Z]/g, "");
- // Convert the cipher text to uppercase and replace 'J' with 'I'
- let modifiedCipherText = cipherText
- .toUpperCase()
- .replace(/J/g, "I")
- .replace(/[^A-Z]/g, "");
+ modifiedCipherText = removeDuplicates(modifiedCipherText);
- modifiedCipherText = removeDuplicates(modifiedCipherText);
+ // Function to remove duplicate characters
+ function removeDuplicates(str) {
+ let uniqueChars = "";
+ for (let char of str) {
+ if (!uniqueChars.includes(char)) {
+ uniqueChars += char;
+ }
+ }
+ return uniqueChars;
+ }
- // Function to remove duplicate characters
- function removeDuplicates(str) {
- let uniqueChars = "";
- for (let char of str) {
- if (!uniqueChars.includes(char)) {
- uniqueChars += char;
- }
- }
- return uniqueChars;
- }
+ // console.log(modifiedCipherText);
+ let ogCipherLength = modifiedCipherText.length;
- // console.log(modifiedCipherText);
- let ogCipherLength = modifiedCipherText.length;
+ // Create a hash to keep track of letters used
+ const hash = {};
- // Create a hash to keep track of letters used
- const hash = {};
+ // Iterate over the modifiedCipherText and mark the letters in the hash
+ for (let i = 0; i < modifiedCipherText.length; i++) {
+ if (modifiedCipherText[i] !== " ") {
+ // Exclude spaces
+ hash[modifiedCipherText[i]] = (hash[modifiedCipherText[i]] || 0) + 1;
+ if (modifiedCipherText[i] === "I") hash["J"] = 1; // Mark 'J' as used if 'I' is used
+ }
+ }
- // Iterate over the modifiedCipherText and mark the letters in the hash
- for (let i = 0; i < modifiedCipherText.length; i++) {
- if (modifiedCipherText[i] !== " ") {
- // Exclude spaces
- hash[modifiedCipherText[i]] = (hash[modifiedCipherText[i]] || 0) + 1;
- if (modifiedCipherText[i] === "I") hash["J"] = 1; // Mark 'J' as used if 'I' is used
- }
- }
+ // Create a string to hold the unique letters for the cipher
+ let uniqueLetters = "";
- // Create a string to hold the unique letters for the cipher
- let uniqueLetters = "";
+ // Iterate over the alphabet (excluding 'J') and add letters not in the hash to the uniqueLetters string
+ for (
+ let charCode = "A".charCodeAt(0);
+ charCode <= "Z".charCodeAt(0);
+ charCode++
+ ) {
+ const letter = String.fromCharCode(charCode);
+ if (letter !== "J" && !hash[letter]) {
+ uniqueLetters += letter;
+ }
+ }
- // Iterate over the alphabet (excluding 'J') and add letters not in the hash to the uniqueLetters string
- for (
- let charCode = "A".charCodeAt(0);
- charCode <= "Z".charCodeAt(0);
- charCode++
- ) {
- const letter = String.fromCharCode(charCode);
- if (letter !== "J" && !hash[letter]) {
- uniqueLetters += letter;
- }
- }
+ if (!hash["J"]) {
+ uniqueLetters += "J";
+ }
- if (!hash["J"]) {
- uniqueLetters += "J";
- }
-
- modifiedCipherText += uniqueLetters;
-
- return (
-
- {matrix5x5.map((row, i) => (
-
- {row.map((_, j) => (
-
-
- {modifiedCipherText[(i * 5 + j) % modifiedCipherText.length] ===
- "I"
- ? "I/J"
- : modifiedCipherText[(i * 5 + j) % modifiedCipherText.length]}
-
-
- ))}
-
- ))}
-
- );
+ modifiedCipherText += uniqueLetters;
+ return (
+
+ {matrix5x5.map((row, i) => (
+
+ {row.map((_, j) => (
+
+
+ {modifiedCipherText[(i * 5 + j) % modifiedCipherText.length] ===
+ "I"
+ ? "I/J"
+ : modifiedCipherText[(i * 5 + j) % modifiedCipherText.length]}
+
+
+ ))}
+
+ ))}
+
+ );
};
export default FiveFiveStatic;
diff --git a/fairplay/src/components/FiveFiveStatic/FiveFiveStatic.module.css b/fairplay/src/components/FiveFiveStatic/FiveFiveStatic.module.css
index 53f8028..cf0bc28 100644
--- a/fairplay/src/components/FiveFiveStatic/FiveFiveStatic.module.css
+++ b/fairplay/src/components/FiveFiveStatic/FiveFiveStatic.module.css
@@ -16,43 +16,42 @@
justify-content: center;
align-items: center;
- font-size: var(--size2);
- }
-
- .box:hover {
+ font-size: 30px;
+}
+
+.box:hover {
+
scale: 1.1;
transition: ease 0.3s;
- }
-
- /* Add styles for animate__pulse class */
- .animate__pulse {
+}
+
+/* Add styles for animate__pulse class */
+.animate__pulse {
animation: anpulse 1s infinite; /* Adjust animation duration and other properties as needed */
- }
-
- .row {
+}
+
+.row {
display: flex;
flex-direction: row;
align-items: center;
justify-content: center;
- }
-
- .x {
+}
+
+.x {
background-color: yellow; /* Change background color to yellow */
font-weight: bold; /* Make text bold */
/* Add any other styling you want */
animation: pulse 1s ease 0.3s 3 linear infinite;
- }
-
- @keyframes pulse {
+}
+
+@keyframes pulse {
0% {
- transform: scale(1);
+ transform: scale(1);
}
50% {
- transform: scale(1.1);
+ transform: scale(1.1);
}
100% {
- transform: scale(1);
+ transform: scale(1);
}
- }
-
-
+}