21BCY10033
21BCY10033
Submitted by
Name: AYUSH AMAN
Reg. No. : 21BCY10033
BACHELOR OF TECHNOLOGY
in
COMPUTER SCIENCE AND ENGINEERING
(CYBER SECURITY and DIGITAL FORENSICS)
KOTHRIKALAN, SEHORE
MADHYA PRADESH - 466114
April 2025
VIT BHOPAL UNIVERSITY, KOTHRIKALAN, SEHORE
MADHYA PRADESH - 466114
BONAFIDE CERTIFICATE
Program Chair,
Dr. D. Sarvanan,
Assistant Professor Sr.,
School of Computer Science and Engineering
Certification obtained from Industry
Though I have put in my best efforts to prepare this report with care and
dedication, I acknowledge that it may have some imperfections, and I take full
responsibility for them.
It has been a great honor to convey my heartfelt thanks to everyone who has
directly or indirectly contributed to the completion of this report.
ABSTRACT
The crack_the_hash project aims to develop a specialized command-line tool
implemented in Rust for recovering plaintext passwords from their SHA-1 hash
representations. The primary purpose is to provide a streamlined, efficient solution
for authorized password recovery scenarios while demonstrating Rust's capabilities
for cryptographic applications.
Blue Yonder, formerly known as JDA Software, has a rich history in the
supply chain and retail technology space. Here's a brief overview:
1990s - Growth and Expansion: During the 1990s, JDA expanded its
offerings and became a leading provider of solutions for retail management,
including demand forecasting, replenishment, and sales analysis. The
company grew through both organic development and strategic acquisitions,
broadening its portfolio to include solutions for merchandising, pricing, and
store operations.
Blue Yonder is also recognized for its advanced capabilities in supply chain
planning and optimization. Through tools like Luminate Planning, the
company helps businesses optimize inventory levels, production schedules,
and sourcing decisions. The use of AI in these areas enables companies to
reduce excess inventory, streamline operations, and allocate resources more
efficiently. Additionally, Blue Yonder’s solutions support sustainability
efforts by minimizing waste, improving transportation routes, and ensuring
that businesses can make more eco-friendly decisions while still achieving
operational goals.
The company’s impact is evident through its work with major global
companies such as Walmart, PepsiCo, Coca-Cola, and L’Oréal, Google, HP,
DELL, Starbucks and over 3000+ more customers. These partnerships
showcase the tangible results of Blue Yonder’s solutions, which drive
efficiency and innovation at scale. The company’s ability to deliver
measurable outcomes and help businesses thrive in an increasingly complex
global market further cements its position as a leader in the supply chain
industry.
● Summary
As supply chains continue to evolve and embrace digital transformation, the
importance of cybersecurity cannot be overstated. The growing complexity
and interconnectedness of supply chains mean that cybersecurity must be a
foundational component of supply chain management. From securing
third-party vendors and protecting sensitive data to defending against
sophisticated cyberattacks and ensuring business continuity, cybersecurity is
critical to the success and resilience of modern supply chains. As businesses
become more reliant on digital technologies to optimize their operations,
integrating cybersecurity into every aspect of the supply chain is essential
for mitigating risks and safeguarding the long-term sustainability of these
critical global networks.
Ultimately, Blue Yonder’s vision is to lead the digital transformation of
global supply chains, helping businesses not just keep up with but thrive in
the face of increasingly complex challenges in the global marketplace.
Project Description and Outline
● Introduction.
The crack_the_hash tool is a specialized SHA-1 password recovery utility
developed in Rust. This command-line application enables users to recover
plaintext passwords from SHA-1 hash values through both dictionary-based
attacks and brute force methods.
The project thus evolved into a specialized tool for cracking SHA-1 hashes,
with the aim of bridging the gap between theoretical cryptographic
weaknesses and practical penetration testing. The tool was designed to
streamline the process of hash cracking, ensuring efficiency and speed while
supporting advanced attack techniques such as rainbow tables and
wordlist-based attacks. The development of this tool is not just a reaction to
existing vulnerabilities but also a proactive measure to improve security
auditing and help defenders in the field detect and address hash-related
weaknesses.
In essence, the motivation behind this project was rooted in a desire to create
a practical, effective tool that meets the demands of cybersecurity
professionals working to uncover hidden vulnerabilities in hash-based
authentication systems and help organizations strengthen their security
posture.
● Techniques involved in the project.
The crack_the_hash tool employs several effective techniques to efficiently
crack SHA-1 hashes. At its core, the tool utilizes brute-forcing, a method
where the program generates a wide range of potential inputs, hashes them
using the SHA-1 algorithm, and compares each result with the target hash.
While brute-forcing can be time-consuming, it is the most reliable method
for finding the correct input when no prior knowledge of the input is
available. The brute-force approach ensures that, eventually, the correct hash
is found, given sufficient time and computational resources.
The tool also incorporates early exits, meaning it stops the cracking process
as soon as the correct input is found. This optimization prevents unnecessary
calculations after the correct result is identified, improving efficiency. In
cases where salted hashes are encountered, crack_the_hash is designed to
handle these by including the salt value in each hash attempt, ensuring that
the correct salted hash is cracked.
● Problem Statement.
The primary goal of this project was to develop a tool that can efficiently
crack SHA-1 hashes by leveraging different cryptographic cracking
techniques. SHA-1 (Secure Hash Algorithm 1) is commonly used to ensure
data integrity and security, but given its vulnerabilities, attackers may
attempt to reverse the hash to retrieve the original data or password. The
challenge is to create a tool that can break these hashes in a reasonable
amount of time, applying methods such as brute-forcing, dictionary-based
attacks, parallelization, and optimized techniques like rainbow tables to
reduce the time needed for hash cracking.
In the context of cryptographic security, SHA-1 is frequently used to hash
sensitive data, including passwords, certificates, and other data meant to
remain private. While SHA-1 is designed to be a one-way hash function,
meaning it is computationally infeasible to reverse-engineer the hash to
retrieve the original data, it is still susceptible to brute-force attacks when the
input is weak or predictable.
The problem that arises is that while tools exist to crack such hashes, they
are often inefficient, slow, or inadequate for handling large datasets or
complex hash patterns. For a hacker, or for a security professional assessing
the strength of a hashing mechanism, cracking SHA-1 hashes efficiently
becomes an essential skill. However, as SHA-1 remains a relatively strong
hashing algorithm compared to older methods, effectively cracking it
requires sophisticated approaches that balance computational power with
time efficiency.
● Summary.
The tool focuses on targeting weak or predictable inputs by testing common
passwords or phrases before resorting to exhaustive brute-force attempts. It
also incorporates parallel processing to leverage multiple CPU cores,
improving cracking efficiency. crack_the_hash is particularly useful for
security researchers, penetration testers, or anyone seeking to test the
robustness of SHA-1 hashing mechanisms.
Related Work Investigation
● Introduction.
JohnTheRipper is the most popular password cracking tool used for hash
cracking. It supports a variety of cryptographic algorithms, including
SHA-1, and employs multiple cracking techniques such as brute-force
attacks, dictionary-based attacks, and rainbow tables to attempt to reverse
the hashing process. The tool has been optimized for high performance,
leveraging powerful hardware acceleration (like GPUs) to expedite the
cracking process, making them suitable for large-scale hash-cracking
operations.
We can see that the hash has been cracked and the p@$$word has been
recovered.
● Pros and Cons of the stated existing work.
JohnTheRipper is a highly versatile and efficient password cracking tool,
supporting a wide range of hashing algorithms used across various platforms
like Linux, Windows, and macOS. Its performance is optimized for speed,
incorporating techniques like SIMD (Single Instruction, Multiple Data) to
enable fast processing on supported hardware. The tool is open-source,
allowing users to modify it as needed, and it is compatible with multiple
platforms, making it accessible for a wide range of users. Additionally, JtR
provides customizable cracking methods, supporting dictionary-based,
brute-force, and hybrid attacks, which allows for flexibility in testing
password strength. With a large community of contributors, the tool benefits
from continuous development and support. It also offers advanced features
such as distributed cracking, enabling users to harness multiple machines for
more extensive password cracking tasks. However, despite its advantages,
John the Ripper can be complex for beginners, particularly those who are not
familiar with command-line tools. The tool's setup and configuration require
a certain level of technical knowledge. Cracking passwords can be
time-consuming, especially for those with strong encryption or longer
lengths. The tool can also be resource-intensive, requiring significant CPU
and memory power, which may limit its use on low-resource systems.
Additionally, while it supports a wide array of hashing algorithms,
JohnTheRipper does not guarantee success in cracking every password,
particularly those protected by more advanced hashing techniques. Lastly,
the tool must be used responsibly, as its misuse in unauthorized scenarios
can result in legal and ethical consequences.
● Summary.
A command-line application that matches the capabilities of John the Ripper
should be developed to combine the power of efficient password cracking
with improved ease of use, flexibility, and performance. While
JohnTheRipper is already a powerful tool, it can be complex for users,
particularly when it comes to setup, configuration, and understanding
command-line syntax. A new command-line application could streamline the
process with better documentation, simplified commands, and built-in
templates for common cracking scenarios, reducing the barrier for users who
may not be as experienced with the tool.
Requirement Artifacts
● Introduction.
This report introduces the crack_the_hash tool, a command-line password
cracking tool designed to address the limitations of existing solutions like
John the Ripper while retaining essential features. crack_the_hash is being
developed using the Rust programming language, known for its
performance, memory safety, and thread-safety capabilities, making it an
ideal choice for this project. The primary goal is to create a tool that is both
efficient and user-friendly, optimized for modern hardware and capable of
supporting multiple hashing algorithms.
● Software requirements.
To build this project, the following software requirements have to be met.
○ Rust Toolchain
■ Install the latest stable version of Rust from Rust's official
website.
■ Besides, we also need to install cargo,the Rust package
manager and build tool (comes bundled with the Rust
installation).
○ Dependencies
■ sha1 crate, to compute SHA-1 hashes.
■ hex crate, for encoding and decoding hexadecimal strings.
○ Development Environment
■ Text Editor/IDE, examples include VS Code (with Rust
extension), IntelliJ IDEA (with Rust plugin), or Vim.
■ Terminal/Command Prompt, to run cargo commands for
building and executing the project.
● Summary.
To develop and run the crack_the_hash tool in Rust, we will need the Rust
toolchain, which includes the Rust compiler and cargo package manager.
We can install these from the official Rust website. The tool will rely on two
main dependencies: the sha1 crate for SHA-1 hashing and the hex crate for
encoding and decoding hexadecimal strings. We can develop the tool on
Linux, macOS, or Windows, using any modern text editor or IDE, such as
VS Code or IntelliJ IDEA with the Rust plugin.
Design Methodologies with its Novelty
Error Handling is critical to the robustness of the tool. Given that the tool
involves various operations, such as reading files, processing hashes, and
executing cracking algorithms, proper error handling ensures the system
remains stable even when encountering invalid inputs or unexpected
situations. The error handling module is designed to gracefully manage
issues like incorrect hash formats, missing files, unsupported hash types, or
invalid configurations. It provides clear, user-friendly error messages,
allowing users to quickly identify and resolve problems without crashing the
entire tool. Additionally, it ensures that any runtime issues, like I/O failures
or invalid argument inputs, are properly logged and reported.
Crates are external libraries that significantly extend the functionality of the
tool. For the crack_the_hash tool, two key crates are used: the sha1 crate
for generating SHA-1 hashes and the hex crate for encoding and decoding
hexadecimal strings. These crates simplify the implementation by providing
optimized, pre-built functions for cryptographic operations. The sha1 crate
handles the computation of the hash from plaintext passwords, while the hex
crate efficiently encodes the resulting hash into a hexadecimal string for
comparison. Both crates are highly optimized, ensuring that the tool remains
fast and efficient even when performing numerous hash calculations.
In addition to these modules, Rust’s error handling system (using the Result
and Option types) helps to further improve the robustness of the tool,
enabling it to handle expected and unexpected errors in a controlled manner.
The combination of clear error messages, efficient file handling, and
optimized crates ensures that crack_the_hash operates reliably, is easy to
use, and can handle large inputs and various edge cases effectively.
● Summary
The crack_the_hash tool is a lightweight, efficient command-line interface
(CLI) application built in Rust, designed to crack hashed passwords using a
wordlist and target hash. The tool follows a modular architecture, with key
components including hash handling, cracking algorithms, file input/output,
error handling, and user feedback. It processes user input through simple
command-line arguments, ensuring an intuitive experience with clear error
messages and progress updates. By leveraging Rust’s memory safety and
performance features, such as efficient file reading and zero-cost
abstractions, the tool ensures fast operation, even with large datasets.
External crates like sha1 and hex are utilized to handle hashing and
encoding tasks efficiently. The tool’s modular design allows for easy
maintenance and future extensions, while its CLI format makes it versatile
for use in scripts or automated environments. Overall, crack_the_hash
combines simplicity, performance, and flexibility, offering an effective
solution for password hash cracking in a minimalistic CLI environment.
Technical Implementation and Analysis
● Introduction.
We now shift our focus on the development process of the crack_the_hash
tool, detailing the technical decisions that ensure its functionality, efficiency,
and reliability. This section provides a comprehensive look at the core code
components and the logic behind the tool, from processing user inputs to
executing the password-cracking algorithms. We chose the Rust
programming language for its memory safety, high performance, and
concurrency support, which are essential for creating a fast, efficient
command-line tool. The tool operates by accepting a SHA-1 hash and a
wordlist as inputs, iterating through each word in the list, hashing it, and
comparing it to the target hash. Rust's ownership and borrowing principles
allow us to handle large wordlists efficiently, without using excessive
memory.
The first step in creating the crack_the_hash tool is to initialize a
new Rust project using Cargo, Rust's package manager and build
system. This can be done by running the command cargo new
crack_the_hash in the terminal. This command creates a new
directory called crack_the_hash, which contains the basic structure
for a Rust project, including the Cargo.toml file (where dependencies
and project metadata are specified) and the src/main.rs file (which
serves as the entry point for the application). With this setup, we now
have a clean and ready project environment to begin implementing the
core functionality of the password-cracking tool. The next step is to
navigate into the newly created project directory and open
src/main.rs to start writing the necessary logic.
Now the code uses the std::env module to read command-line
arguments passed to the crack_the_hash tool. The env::args()
function returns an iterator over the command-line arguments
provided when running the program. By calling .collect() on this
iterator, the arguments are gathered into a vector of strings
(Vec<String>). The first element of this vector (args[0]) represents
the name of the program itself, and subsequent elements contain the
arguments provided by the user, such as the wordlist file and the target
hash. This allows the program to dynamically access and process user
inputs directly from the command line, enabling it to handle different
configurations (like the hash type and wordlist file) as specified by the
user when running the tool. This foundational step sets up the
mechanism for accepting input in the form of arguments, which can
then be used for further processing within the program.
○ Displaying an error message
Now the code is designed to handle potential user input errors by
validating the number of command-line arguments passed to the
program. The env::args() function collects the arguments into a
vector (Vec<String>), and the code checks if the length of the vector
is exactly 3. This ensures that the user has provided both the wordlist
file and the target SHA-1 hash, along with the program name itself. If
the number of arguments is not equal to 3, indicating incorrect or
insufficient input, the program prints an error message to the user with
the correct usage format: crack_the_hash: <wordlist.txt>
<sha1_hash>. This serves as an informative prompt to guide the user
in providing the correct inputs. By using this error-checking
mechanism, the tool ensures that it only proceeds with valid inputs,
improving usability and reducing the chance of runtime errors due to
missing or incorrect arguments.
○ Error Handling
In this part of the code, error handling is implemented to ensure that
the crack_the_hash tool gracefully handles potential issues, such as
incorrect user inputs. The function signature of main() is defined as
Result<(), Box<dyn Error>>, which means it returns a Result type
that either yields Ok(()) on success or an error of type Box<dyn
Error> if something goes wrong. First, the code checks if the correct
number of command-line arguments is provided (exactly 3
arguments). If not, an error message is displayed, prompting the user
on the correct usage format, and the program exits early with Ok(()),
meaning no further action is taken. Next, the tool verifies that the
SHA-1 hash provided by the user has the correct length, as SHA-1
hashes are always 40 characters long. If the hash length is invalid, an
error is returned with a descriptive message ("sha1 hash is not valid"),
using Err("sha1_hash_is_not_valid".into()). This ensures that the
program will only proceed if valid inputs are provided, and in case of
an error, it provides clear, informative feedback to the user, allowing
them to easily correct the issue and retry the process. This error
handling approach improves robustness and prevents the program
from continuing with faulty data.
○ Reading Files
In this section of the code, file reading is implemented to load and
process the wordlist file provided by the user. The code utilizes the
std::fs::File module to open the file specified by the user in the
command-line arguments (args[1]). If the file cannot be opened (for
example, if the file does not exist or the program lacks the necessary
permissions), the program will return an error. The BufReader from
the std::io module is used to efficiently read the file line by line,
which helps manage memory usage, especially for large wordlist files.
Using BufReader::new(&wordlist_file), a buffered reader is created
that wraps the file, enabling efficient reading. The code then enters a
loop where each line in the wordlist file is processed. For each line,
the program trims any leading or trailing whitespace and converts it
into a String. This string is then printed to the console with
println!("{}", line);, allowing the user to see the wordlist's contents
(this can be useful for debugging purposes). This approach ensures
that the wordlist is read line by line, making it memory efficient and
ready to be used in the password-cracking algorithm. If an error
occurs while reading the file, the program will propagate the error
through the Result type, ensuring that any issues with file reading are
handled properly.
In the Cargo.toml file, two essential external crates are specified as
dependencies for the crack_the_hash tool: sha-1 and hex. The sha-1
crate (version 0.9) is used to implement the SHA-1 hashing algorithm,
which is central to the tool's functionality. This crate allows the
program to generate SHA-1 hashes from wordlist entries and compare
them with the target hash provided by the user. The second crate, hex
(version 0.4), is used to encode and decode hexadecimal data, which
is necessary because the SHA-1 hash values are typically represented
as hexadecimal strings. The hex crate enables the conversion of raw
byte data into a hexadecimal string format, allowing the tool to
correctly compare the hashed wordlist entries to the input hash. By
incorporating these crates, the project can efficiently leverage
pre-built, tested libraries for these crucial tasks, avoiding the need to
manually implement complex hashing and encoding logic. This
approach streamlines development and ensures the tool performs its
tasks reliably and efficiently.
In the final implementation of the crack_the_hash tool, the program
begins by reading the command-line arguments provided by the user.
It expects two arguments: the path to the wordlist file and the SHA-1
hash to crack. The program checks if the correct number of arguments
is passed (three, including the program name), and if not, it displays a
usage message and exits. Next, the target SHA-1 hash is validated to
ensure it is exactly 40 characters long, as this is the standard length for
SHA-1 hashes. If the hash is invalid, the program returns an error with
an appropriate message.
The wordlist file is then opened using the File::open method, and a
buffered reader (BufReader) is created to efficiently read the file line
by line. For each line in the wordlist, the program trims any extra
whitespace, hashes the line using the sha1 crate, and compares the
result with the provided hash. If a match is found, the program prints
the cracked password and exits. If the hash does not match any word
in the list, the program prints a message indicating that the password
was not found. Throughout the process, the program handles potential
errors using Rust's Result type, ensuring smooth execution and clear
error messages when necessary. This final implementation
encapsulates the core logic for cracking a SHA-1 hash using a
wordlist, leveraging Rust's performance and safety features to create a
fast and reliable tool.
To test our crack_the_hash tool, we begin by preparing a wordlist file that
contains a list of common passwords. Next, we generate the SHA-1 hash of
one of these passwords using an online tool or command-line utility. With
the wordlist and SHA-1 hash ready, we run the program by passing the
wordlist file and the hash as command-line arguments in the terminal. If the
hash matches a password in the wordlist, the program will output "Password
found: p@$$w0rd." If no match is found, it will display "password not found
in wordlist :(". Additionally, we test edge cases, such as providing incorrect
arguments, using an invalid hash length, or passing an empty wordlist,
ensuring the tool handles these scenarios correctly and gracefully.
● Summary.
The crack_the_hash tool works by accepting a SHA-1 hash and a wordlist
file as command-line arguments. It validates the inputs to ensure the correct
number of arguments and verifies that the SHA-1 hash has the proper length.
The tool then opens the wordlist file and reads it line by line. For each word,
it hashes the word using the SHA-1 algorithm and compares the generated
hash with the provided SHA-1 hash. If a match is found, it prints the
corresponding password and exits. If no match is found after checking all the
words, it informs the user that the password was not found. The tool handles
errors by providing clear messages when the inputs are invalid or when no
matching password is found.
Project Outcome and Applicability
● Introduction.
In this section we will explore the results and impact of the crack_the_hash
tool. This tool is designed to efficiently crack SHA-1 hashes by leveraging a
wordlist-based approach, providing a practical solution for scenarios such as
password recovery and security testing. We will discuss its effectiveness,
potential limitations, and how it can be applied in various real-world
contexts, including security audits, penetration testing, and educational
purposes. This section aims to highlight the value the tool brings to users
and the broader field of cybersecurity.
● Summary
To summarize, the crack_the_hash project presents an efficient
command-line tool designed to crack SHA-1 hashes using a wordlist-based
approach. Developed in Rust, the tool leverages well-established
cryptographic libraries to hash words and compare them to the target hash,
offering a practical solution for password recovery and security testing. The
tool incorporates robust error handling, input validation, and efficient file
processing, making it a reliable utility for security professionals and
educators. While ideal for small to medium-sized wordlists, it also serves as
a foundation for future enhancements. Ultimately, the project demonstrates
the potential of Rust in building fast, secure, and scalable command-line
applications with real-world applicability in cybersecurity.
Conclusion
● Introduction.
The crack_the_hash tool is a straightforward yet powerful command-line
utility designed to crack SHA-1 hashes using a wordlist-based approach.
Developed in Rust, it efficiently handles the process of reading
command-line arguments, validating input, hashing words, and comparing
them with the target hash. While the tool is effective for
small-to-medium-sized wordlists, it provides a solid foundation for
understanding hashing algorithms and password recovery techniques. In this
section, we will reflect on the limitations of the system, potential
enhancements, and summarize key takeaways.
● Future Enhancements.
Future enhancements for the crack_the_hash tool could include the addition
of support for more hash algorithms such as SHA-256, bcrypt, or MD5,
expanding its utility for a broader range of password hashes. Implementing
more advanced cracking techniques, like dictionary-based or brute-force
attacks, could further improve its effectiveness. The performance could be
optimized by parallelizing hash checks or integrating multi-threading.
Additionally, a graphical user interface (GUI) could be developed to make
the tool more accessible to non-technical users. Finally, introducing features
for handling larger wordlists or implementing rainbow tables could
significantly increase the tool's speed and scalability.
● References:
○ Offensive Rust
https://www.youtube.com/live/hlBCiCNUqts?si=lpi_77wvbKikx29S