Skip to content

About

A JavaScript project demonstrating basic cryptography concepts - Caesar Cipher (encryption & decryption) and the Euclidean Algorithm (GCD) using hardcoded input values.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

4 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 

Repository files navigation

Cryptography 1

This repository contains JavaScript implementations of two fundamental cryptographic algorithms:

Caesar Cipher (Encryption and Decryption)

Euclidean Algorithm (Greatest Common Divisor – GCD)

Both algorithms are implemented in a single file (index.js) using hardcoded input values to clearly demonstrate their functionality.

📚 Overview

Cryptography relies heavily on mathematical concepts and algorithmic transformations. This project introduces:

Basic encryption and decryption using substitution ciphers

Number theory fundamentals used in modern cryptographic systems

🛠️ Technologies Used

JavaScript

Node.js

📂 Project Structure Cryptography-1/ ├── index.js └── README.md

🔐 Caesar Cipher Description

The Caesar Cipher is a classical substitution cipher where each alphabetic character in a message is shifted forward by a fixed number of positions (the key).

Uppercase and lowercase letters are preserved

Non-alphabetic characters remain unchanged

Modular arithmetic is used to handle wrap-around at the end of the alphabet

Hardcoded Input Message: "Hello World" Key: 3

Output Original Message: Hello World Encrypted Message: Khoor Zruog Decrypted Message: Hello World

Explanation

Each character is converted to its ASCII value, shifted using modulo 26, and then converted back to a character. Decryption reverses the shift using the same key.

🔢 Euclidean Algorithm (GCD) Description

The Euclidean Algorithm is an efficient method for computing the Greatest Common Divisor (GCD) of two integers.

It repeatedly replaces the larger number with the remainder obtained from dividing it by the smaller number until the remainder becomes zero.

Hardcoded Input First Number: 48 Second Number: 18

Output First Number: 48 Second Number: 18 Greatest Common Divisor (GCD): 6

▶️ Running the Program

Ensure Node.js is installed on your system, then execute:

node index.js

This command runs both the Caesar Cipher and Euclidean Algorithm using the predefined hardcoded values.

🧠 Cryptographic Significance

Caesar Cipher introduces the concept of symmetric encryption

Euclidean Algorithm is foundational in:

RSA cryptography

Modular inverses

Elliptic Curve Cryptography (ECC)

📸 Program Output Screenshot

Cryptography Program Output

About

A JavaScript project demonstrating basic cryptography concepts - Caesar Cipher (encryption & decryption) and the Euclidean Algorithm (GCD) using hardcoded input values.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages