Welcome to the repository for the AI/ML-Based Cryptographic Algorithm Identification project. This repository is maintained primarily for learning and applying practical knowledge across cryptography, machine learning, and full-stack development. The system analyzes encrypted/hash-like data patterns to estimate which cryptographic algorithm may have produced them, while also exposing educational tooling for encryption samples, prediction metadata, and benchmark diagnostics.
In today’s digital age, cryptographic algorithms are the backbone of secure communication, data protection, and privacy. However, as cyber threats evolve, attackers often exploit weaknesses in cryptographic implementations or use outdated algorithms to breach systems. Identifying the cryptographic algorithm used in a given dataset or communication stream is a critical step in assessing security vulnerabilities, but this process is highly complex and time-consuming when done manually.
- Rising Cyberattacks: Attackers frequently use weak or deprecated cryptographic algorithms to exploit systems. Identifying these algorithms in real-time is crucial for preventing breaches.
- Lack of Automation: Security analysts often rely on manual analysis or heuristic methods to identify cryptographic algorithms, which is error-prone and inefficient.
- Complexity of Modern Cryptography: With the proliferation of cryptographic standards (e.g., AES, RSA, ECC, ChaCha20) and custom implementations, it’s nearly impossible for humans to analyze and identify algorithms at scale.
- Hidden Weaknesses: Even strong algorithms can have weak implementations or configurations, which are difficult to detect without advanced pattern recognition.
This project aims to address these challenges by developing an AI/ML-based system that can automatically identify cryptographic algorithms from modern cryptographic datasets. By leveraging machine learning, the system will:
- Analyze data patterns and features to determine the algorithm used.
- Automate the identification process, reducing manual effort and human error.
- Provide insights into potential weaknesses in cryptographic implementations.
- Enhance the ability of security teams to respond to threats in real-time.
- Data Complexity: Cryptographic datasets are highly complex, with patterns that are difficult to discern without advanced ML techniques.
- Algorithm Diversity: Modern cryptography involves a wide range of algorithms, each with unique characteristics and implementations.
- Real-Time Requirements: Identifying algorithms in real-world scenarios requires high accuracy and low latency, which is challenging to achieve.
- Adversarial Environments: Attackers often obfuscate or modify cryptographic implementations to evade detection, making the problem even more complex.
This project has the potential to revolutionize cryptographic security by:
- Enabling faster and more accurate identification of cryptographic algorithms.
- Helping organizations detect and mitigate vulnerabilities in their systems.
- Providing a foundation for building smarter, AI-driven security tools.
- Contributing to the global effort to combat cybercrime and protect sensitive data.
By tackling this problem, we aim to bridge the gap between cryptography, machine learning, and cybersecurity, creating a tool that is both innovative and impactful in the real world.
You can view the project presentation, some key points are discussed in this ppt regarding the project here:
Our project uses a practical full-stack architecture that combines frontend UI, backend APIs, and ML inference.
- React 19 + Vite 6 + TypeScript
- Tailwind CSS 4, Framer Motion, and Lucide React
- Redux Toolkit for auth state management
- Axios for API integration
- Python-based prediction pipeline under
Backend/src/main/resources/scripts - Hybrid model artifacts (
model.pickle,label_map.pickle) - Core libs:
numpy,scipy,scikit-learn,pycryptodome
- Spring Boot 3.4 (Java 21)
- Spring Security + JWT-based auth
- Spring Data JPA
- H2 default for local dev, MySQL-ready configuration for production
Install these before running locally:
- Java 21
- Maven (or use
./mvnwwrapper) - Node.js 20+ and npm
- Python 3.10+
- Git
git clone https://github.com/Ashita-no-Kaushar/Team-project.git
cd Team-projectcd Backendpython3 -m venv .venv
source .venv/bin/activate
pip install -r src/main/resources/scripts/requirements.txt- Default local setup uses in-memory H2 from
application.properties. - For production, switch to MySQL/PostgreSQL settings in
application.propertiesor environment variables.
JAVA_HOME=/usr/lib/jvm/java-21-openjdk-amd64 PATH=/usr/lib/jvm/java-21-openjdk-amd64/bin:$PATH ./mvnw spring-boot:runcd ../Frontendnpm cinpm run dev -- --host 0.0.0.0 --port 5173http://localhost:5173
curl http://localhost:8080/api/encryption/aes
curl -X POST http://localhost:8080/api/ml/predict -H "Content-Type: application/json" -d '{"input_hex":"00112233445566778899aabbccddeeff"}'POST /api/ml/predictis public./api/ml/model-info,/api/ml/benchmark, and/api/ml/benchmark/historyrequire JWT authentication.
Team-project/
├── Backend/
│ ├── pom.xml
│ ├── mvnw
│ ├── src/main/java/com/project/backend/
│ │ ├── Controllers/
│ │ │ ├── AuthController.java
│ │ │ ├── EncryptionController.java
│ │ │ ├── MLController.java
│ │ ├── Services/
│ │ │ ├── MLService.java
│ │ │ ├── GeneratedSampleRegistryService.java
│ │ │ ├── BenchmarkHistoryService.java
│ │ ├── Entities/
│ │ │ ├── PredictionResult.java
│ ├── src/main/resources/
│ │ ├── application.properties
│ │ ├── scripts/
│ │ │ ├── predict.py
│ │ │ ├── train_model.py
│ │ │ ├── requirements.txt
├── Frontend/
│ ├── package.json
│ ├── vite.config.ts
│ ├── src/
│ │ ├── components/
│ │ │ ├── PredictionPage.tsx
│ │ │ ├── SignUp.tsx
The CryptographicDataController provides REST endpoints to manage cryptographic data.
It allows retrieving cryptographic data by ID, fetching the last 20 cryptographic data entries,
and updating the correctedData status of a specific entry.
- Endpoint:
/api/cryptographic-data/last20 - Method:
GET - Description: Fetches the last 20 cryptographic data entries for the current user.
- Endpoint:
/api/cryptographic-data/correctedData/{id} - Method:
PUT - Description: Updates the
correctedDatastatus of a cryptographic entry. - Request Parameters:
id(Path Variable) → ID of the cryptographic data.correctedData(Query Parameter) → Boolean value to update the corrected data status.
- Endpoint:
/api/cryptographic-data/{id} - Method:
GET - Description: Retrieves cryptographic data based on the given ID.
- Request Parameters:
id(Path Variable) → ID of the cryptographic data.
The EncryptionController provides REST endpoints for encrypting data using various cryptographic algorithms.
It supports symmetric encryption (AES, DES, Triple DES, Blowfish, RC2, RC4, ChaCha20),
asymmetric encryption (RSA), digital signatures (DSA, ECDSA), key exchanges (Diffie-Hellman, ECDH),
and hashing algorithms (MD5, SHA-1, SHA-256, SHA-512, SHA-3-256).
-
AES Encryption
- Endpoint:
/api/encryption/aes - Method:
GET - Description: Encrypts data using AES encryption.
- Endpoint:
-
DES Encryption
- Endpoint:
/api/encryption/des - Method:
GET - Description: Encrypts data using DES encryption.
- Endpoint:
-
Triple DES Encryption
- Endpoint:
/api/encryption/3des - Method:
GET - Description: Encrypts data using Triple DES encryption.
- Endpoint:
-
Blowfish Encryption
- Endpoint:
/api/encryption/blowfish - Method:
GET - Description: Encrypts data using Blowfish encryption.
- Endpoint:
-
RC2 Encryption
- Endpoint:
/api/encryption/rc2 - Method:
GET - Description: Encrypts data using RC2 encryption.
- Endpoint:
-
RC4 Encryption
- Endpoint:
/api/encryption/rc4 - Method:
GET - Description: Encrypts data using RC4 encryption.
- Query Parameter:
plaintext(Optional) → The text to encrypt.
- Endpoint:
-
ChaCha20 Encryption
- Endpoint:
/api/encryption/chacha20 - Method:
GET - Description: Encrypts data using ChaCha20 encryption.
- Endpoint:
- RSA Encryption
- Endpoint:
/api/encryption/rsa - Method:
GET - Description: Encrypts data using RSA encryption.
- Endpoint:
-
DSA Signature Generation
- Endpoint:
/api/encryption/dsa - Method:
GET - Description: Generates a digital signature using DSA.
- Endpoint:
-
ECDSA Signature Generation
- Endpoint:
/api/encryption/ecdsa - Method:
GET - Description: Generates a digital signature using ECDSA.
-
Diffie-Hellman Key Exchange
- Endpoint:
/api/encryption/diffe - Method:
GET - Description: Performs a key exchange using Diffie-Hellman.
- Endpoint:
-
ECDH Key Exchange
- Endpoint:
/api/encryption/ecdh - Method:
GET - Description: Performs a key exchange using ECDH.
- Endpoint:
-
MD5 Hash Generation
- Endpoint:
/api/encryption/md5 - Method:
GET - Description: Generates an MD5 hash.
- Endpoint:
-
SHA-1 Hash Generation
- Endpoint:
/api/encryption/sha1 - Method:
GET - Description: Generates a SHA-1 hash.
- Endpoint:
-
SHA-256 Hash Generation
- Endpoint:
/api/encryption/sha256 - Method:
GET - Description: Generates a SHA-256 hash.
- Endpoint:
-
SHA-512 Hash Generation
- Endpoint:
/api/encryption/sha512 - Method:
GET - Description: Generates a SHA-512 hash.
- SHA-3-256 Hash Generation
- Endpoint:
/api/encryption/sha3-256 - Method:
GET - Description: Generates a SHA-3-256 hash.
- Endpoint:
The MLController provides REST endpoints for predicting cryptographic algorithms used in encryption.
It processes input hexadecimal strings and determines the corresponding algorithm using machine learning techniques.
- Endpoint:
/api/ml/predict - Method:
POST - Description: Predicts the cryptographic algorithm used for encryption based on the provided hexadecimal string.
- Endpoint:
/api/ml/model-info - Method:
GET - Description: Returns ML runtime metadata (model version, confidence threshold, artifact availability, timeout settings).
- Auth:
Authorization: Bearer <token>required.
- Endpoint:
/api/ml/benchmark - Method:
GET - Query Parameter:
mode(optional) =hash-only|mixed|strict(default:mixed) - Description: Runs benchmark cases and returns summary metrics.
- Auth:
Authorization: Bearer <token>required.
- Endpoint:
/api/ml/benchmark/history - Method:
GET - Query Parameters:
mode(optional): filter byhash-only,mixed,strictlimit(optional): number of records to return
- Description: Returns recent benchmark runs for trend analysis.
- Auth:
Authorization: Bearer <token>required.
mode: benchmark mode used for the run.run_at: timestamp when benchmark executed.total_cases,passed_cases,pass_rate: benchmark accuracy summary.duration_ms: runtime for the benchmark.avg_confidence: average model confidence across benchmark cases (when available).results: per-case details including expected algorithm, predicted algorithm, source, confidence, and match status.
POST /api/ml/predictremains public for prediction requests./api/ml/model-info,/api/ml/benchmark, and/api/ml/benchmark/historyrequire JWT authentication.
The AuthController provides REST endpoints for user authentication, including signup, login, token refresh, and logout.
It integrates with authentication services to manage user access securely.
- Endpoint:
/api/auth/signup - Method:
POST - Description: Registers a new user with the provided credentials.
- Endpoint:
/api/auth/login - Method:
POST - Description: Authenticates the user and returns an access token.
- Endpoint:
/api/auth/refresh - Method:
POST - Description: Refreshes the access token using a valid refresh token.
- Endpoint:
/api/auth/logout - Method:
POST - Description: Logs out the user by invalidating the current session tokens.
The AlgorithmController provides endpoints to retrieve cryptographic algorithms, including fetching all algorithms in random order, retrieving a specific algorithm by name, and getting random algorithms excluding a specific one.
- Endpoint:
/api/algorithms/random - Method:
GET - Description: Returns a list of all algorithms in a randomized order.
- Endpoint:
/api/algorithms/{algo} - Method:
GET - Description: Fetches details of a specific algorithm by its name.
- Endpoint:
/api/algorithms/random/exclude - Method:
GET - Description: Retrieves four random algorithms while excluding a specified algorithm.
- Query Parameter:
exclude– The name of the algorithm to exclude from the results.
The UserController provides endpoints for managing user profiles, including updating user details and retrieving authenticated user information.
- Endpoint:
/api/users/update - Method:
PUT - Description: Allows authenticated users to update their profile information.
- Request Body:
UpdateUserRequest– Contains updated user details. - Authentication: Required.
- Endpoint:
/api/users/me - Method:
GET - Description: Retrieves the details of the currently authenticated user based on the provided JWT token.
- Request Header:
Authorization: Bearer <token>– JWT token for authentication. - Response: Returns the username, first name, and last name of the authenticated user.
#Images of Project

















