0
0
Cybersecurityknowledge~10 mins

Hashing algorithms (SHA, MD5) in Cybersecurity - Step-by-Step Execution

Choose your learning style9 modes available
Concept Flow - Hashing algorithms (SHA, MD5)
Input Data
Apply Hash Function
Process Data in Blocks
Perform Mathematical Operations
Generate Fixed-Size Hash Output
Output Hash Value
Data is taken as input, processed through a hash function in blocks, mathematical operations create a fixed-size output called a hash.
Execution Sample
Cybersecurity
Input: "hello"
Apply MD5 hash function
Output: 5d41402abc4b2a76b9719d911017c592
This shows how the string "hello" is converted into a fixed-size MD5 hash.
Analysis Table
StepActionInput/StateOutput/Result
1Receive input data"hello""hello"
2Convert input to bytes"hello"[104, 101, 108, 108, 111]
3Process data in 512-bit blocks[104, 101, 108, 108, 111]Single block padded
4Perform MD5 compression functionPadded blockIntermediate hash state
5Repeat for all blocks (only one here)Intermediate hash stateFinal hash value
6Output hashFinal hash value"5d41402abc4b2a76b9719d911017c592"
💡 All input processed; final fixed-size hash output produced.
State Tracker
VariableStartAfter Step 2After Step 3After Step 4After Step 5Final
input_data"hello""hello""hello""hello""hello""hello"
byte_arrayN/A[104,101,108,108,111][104,101,108,108,111, padding][intermediate state][intermediate state]N/A
hash_stateN/AN/AInitial constantsUpdated stateFinal state"5d41402abc4b2a76b9719d911017c592"
Key Insights - 3 Insights
Why does the output hash always have the same length regardless of input size?
Because hashing algorithms like MD5 and SHA process data in blocks and produce a fixed-size output, as shown in execution_table steps 3 to 6.
Is it possible to get the original input from the hash output?
No, hashing is one-way; the execution_table shows only output generation, no reverse step exists.
Why do we add padding to the input data before hashing?
Padding ensures the input fits into fixed-size blocks required by the hash function, as seen in step 3 of the execution_table.
Visual Quiz - 3 Questions
Test your understanding
Look at the execution_table, what is the output after step 6?
A"5d41402abc4b2a76b9719d911017c592"
B"hello"
C[104, 101, 108, 108, 111]
DIntermediate hash state
💡 Hint
Check the 'Output/Result' column for step 6 in the execution_table.
At which step is the input data converted into bytes?
AStep 1
BStep 2
CStep 4
DStep 6
💡 Hint
Look at the 'Action' column in execution_table for the step mentioning conversion to bytes.
If the input was longer and required multiple blocks, which step would repeat?
AStep 2
BStep 3
CStep 5
DStep 6
💡 Hint
Refer to execution_table step 5 mentioning repetition for all blocks.
Concept Snapshot
Hashing algorithms take any input data and produce a fixed-size string called a hash.
MD5 outputs 128-bit hashes; SHA variants output longer hashes (e.g., SHA-256).
They process data in blocks with padding to fit block size.
Hashes are one-way: you cannot get original data from the hash.
Used for data integrity, password storage, and digital signatures.
Full Transcript
Hashing algorithms like MD5 and SHA take input data and convert it into a fixed-size hash value. The process involves converting the input into bytes, padding it to fit fixed-size blocks, and then applying mathematical operations to produce a unique hash. This hash is always the same length regardless of input size. The process is one-way, meaning you cannot reverse the hash to get the original input. This makes hashing useful for verifying data integrity and securely storing passwords.