From b980d6d3868f32de3c4c07c8f207fd8c5c8dff5b Mon Sep 17 00:00:00 2001 From: Pavitraa G <100479594+pavitraag@users.noreply.github.com> Date: Thu, 18 Jul 2024 19:25:16 +0530 Subject: [PATCH 1/6] Create Readme.md --- Hashing Calculator/Readme.md | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 Hashing Calculator/Readme.md diff --git a/Hashing Calculator/Readme.md b/Hashing Calculator/Readme.md new file mode 100644 index 00000000..5e6d8dec --- /dev/null +++ b/Hashing Calculator/Readme.md @@ -0,0 +1,15 @@ +#

Hashing Message Calculator

+ +## Description :- + +Calculates the hash for your message from one of the widely used hashing algorithms. + +## Tech Stacks :- + +- HTML +- CSS +- JavaScript + +## Screenshots :- + +image From e17d48e8417f041729c94ad75a4a235e0e2e011b Mon Sep 17 00:00:00 2001 From: Pavitraa G <100479594+pavitraag@users.noreply.github.com> Date: Thu, 18 Jul 2024 19:26:03 +0530 Subject: [PATCH 2/6] Create index.html --- Hashing Calculator/index.html | 40 +++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 Hashing Calculator/index.html diff --git a/Hashing Calculator/index.html b/Hashing Calculator/index.html new file mode 100644 index 00000000..21b45d5c --- /dev/null +++ b/Hashing Calculator/index.html @@ -0,0 +1,40 @@ + + + + + + + + + + Hashing Message Calculator + + + +
+

Hashing Message Calculator

+

Make your message secret!

+ + + + + + + + +
+
+
+ +
+ + + + + From fab3516ec95cf522990a32aab0cd155b39097bf7 Mon Sep 17 00:00:00 2001 From: Pavitraa G <100479594+pavitraag@users.noreply.github.com> Date: Thu, 18 Jul 2024 19:26:35 +0530 Subject: [PATCH 3/6] Create script.js --- Hashing Calculator/script.js | 59 ++++++++++++++++++++++++++++++++++++ 1 file changed, 59 insertions(+) create mode 100644 Hashing Calculator/script.js diff --git a/Hashing Calculator/script.js b/Hashing Calculator/script.js new file mode 100644 index 00000000..8887728c --- /dev/null +++ b/Hashing Calculator/script.js @@ -0,0 +1,59 @@ +// Wait for the DOM to fully load +document.addEventListener("DOMContentLoaded", function() { + + // Add event listener to the reset button + document.getElementById("resetButton").addEventListener("click", function() { + document.getElementById("message").value = ""; + document.getElementById("algorithm").value = "md5"; + document.getElementById("result").innerText = ""; + }); +}); + +// Function to calculate hash based on user input +function calculate() { + const message = document.getElementById("message").value; + const algorithm = document.getElementById("algorithm").value; + let hash; + let info; + + if (message === "") { + alert("Please enter a message to hash."); + return; + } + + switch (algorithm) { + case "md5": + hash = CryptoJS.MD5(message).toString(); + info = "Imagine MD5 as a digital fingerprint for your message. It takes your message and turns it into a unique 32-character code."; + fact = "It's super fast but not the best for security anymore—like a really fast lock that's easy to pick!"; + break; + case "sha1": + hash = CryptoJS.SHA1(message).toString(); + info = "SHA-1 is like MD5's older sibling, creating a 40-character code for your message. It's a bit more secure but still not great for super-secret stuff."; + fact = "Think of it as a stronger lock than MD5, but still not strong enough for serious security."; + break; + case "sha256": + hash = CryptoJS.SHA256(message).toString(); + info = "SHA-256 is a security superstar! It takes your message and transforms it into a super secure 64-character code."; + fact = "It's like a high-tech lock that's very hard to crack, perfect for things like online banking and cryptocurrencies."; + break; + case "sha512": + hash = CryptoJS.SHA512(message).toString(); + info = "SHA-512 is like SHA-256 on steroids. It creates a whopping 128-character code, making it ultra-secure."; + fact = "Imagine a fortress with a super complicated lock—it's super safe but takes a bit longer to lock and unlock."; + break; + case "hmac": + const secret = "secret"; // You can customize or prompt for the secret key + hash = CryptoJS.HmacSHA256(message, secret).toString(); + info = "HMAC is like sending a secret message with a special key that only you and your friend know. It ensures that the message hasn’t been tampered with and confirms it’s really from you."; + fact = "It's like a secret handshake that proves the message is legit and hasn't been messed with!"; + break; + default: + alert("Invalid algorithm selected."); + return; + } + + document.getElementById("result").innerText = `Hash (${algorithm}): ${hash}`; + document.getElementById("info").innerText = `More about (${algorithm}): ${info}`; + document.getElementById("fact").innerText = `Fun fact: ${fact}`; +} From a27ff49bc131b05a1c70f029c14a7a6fcbf9b6b0 Mon Sep 17 00:00:00 2001 From: Pavitraa G <100479594+pavitraag@users.noreply.github.com> Date: Thu, 18 Jul 2024 19:27:06 +0530 Subject: [PATCH 4/6] Create style.css --- Hashing Calculator/style.css | 94 ++++++++++++++++++++++++++++++++++++ 1 file changed, 94 insertions(+) create mode 100644 Hashing Calculator/style.css diff --git a/Hashing Calculator/style.css b/Hashing Calculator/style.css new file mode 100644 index 00000000..5848e33f --- /dev/null +++ b/Hashing Calculator/style.css @@ -0,0 +1,94 @@ +body { + font-family: 'Roboto', sans-serif; + display: flex; + align-items: center; + justify-content: center; + height: 100vh; + margin: 0; + background: linear-gradient(135deg, #3498db, #2ecc71); + color: #ecf0f1; +} + +.container { + text-align: center; + background-color: rgba(39, 39, 39, 0.8); /* Semi-transparent container */ + padding: 30px; + border-radius: 10px; + height: 58%; + width: 85%; + box-shadow: 0 0 20px rgba(0, 0, 0, 0.2); +} + +h1 { + color: #ecf0f1; +} + +h3 { + color: #67addb; +} + +label { + margin-right: 5px; + color: #ecf0f1; +} + +/* Adjusted styling for horizontal input boxes */ +.input-group { + display: flex; + justify-content: center; + margin-bottom: 20px; +} + +input { + margin: 0 5px; + padding: 7px; + width: 200px; + border: none; + border-radius: 5px; + background-color: #ecf0f1; + color: #333; +} + +button { + margin-top: 15px; + padding: 15px; + cursor: pointer; + background-color: #3498db; + color: #ffffff; + border: none; + border-radius: 5px; + font-size: 16px; + transition: background-color 0.3s; +} + +button:hover { + background-color: #2980b9; +} + +#result { + margin-top: 15px; + font-weight: bold; + color: #3498db; + border-radius: 5px; + font-size: 18px; + padding: 5px; +} + +#info { + margin-top: 20px; + display: flex; + font-weight: bold; + color: #67addb; + border-radius: 5px; + font-size: 18px; + padding: 5px; +} + +#fact { + margin-top: 15px; + font-weight: bold; + color: #b4defa; + border-radius: 5px; + font-size: 18px; + padding: 5px; +} From 021acd1c2c07432d288631bf7476e49059e9b551 Mon Sep 17 00:00:00 2001 From: Pavitraa G <100479594+pavitraag@users.noreply.github.com> Date: Fri, 19 Jul 2024 06:33:33 +0530 Subject: [PATCH 5/6] Create manifest.json --- Hashing Calculator/manifest.json | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 Hashing Calculator/manifest.json diff --git a/Hashing Calculator/manifest.json b/Hashing Calculator/manifest.json new file mode 100644 index 00000000..b5933308 --- /dev/null +++ b/Hashing Calculator/manifest.json @@ -0,0 +1,9 @@ +{ + "name": "Hashing Message Calculator", + "short_name": "HashCalc", + "description": "A web application to hash messages using various algorithms.", + "start_url": "/", + "display": "standalone", + "background_color": "#ffffff", + "theme_color": "#4CAF50", +} From 97714b744ada6547cbfbf43f19a291ad4cb3138d Mon Sep 17 00:00:00 2001 From: Pavitraa G <100479594+pavitraag@users.noreply.github.com> Date: Fri, 19 Jul 2024 06:34:38 +0530 Subject: [PATCH 6/6] Update manifest.json --- Hashing Calculator/manifest.json | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/Hashing Calculator/manifest.json b/Hashing Calculator/manifest.json index b5933308..eaca2dca 100644 --- a/Hashing Calculator/manifest.json +++ b/Hashing Calculator/manifest.json @@ -1,9 +1,11 @@ { - "name": "Hashing Message Calculator", - "short_name": "HashCalc", - "description": "A web application to hash messages using various algorithms.", - "start_url": "/", - "display": "standalone", - "background_color": "#ffffff", - "theme_color": "#4CAF50", + "manifest_version": 3, + "name": "Hashing Message Calculator", + "version": "1.0", + "description": "A web application to hash messages using various algorithms.", + "permissions": [], + "action": { + "default_popup": "index.html" + } } +