Professional Documents
Culture Documents
Hash Tutorial 2
Hash Tutorial 2
Hash Tutorial
Hash Algorithm
• A hash algorithm is a oneway function that converts a
data string into a numeric string output of fixed length. The
output string is generally much smaller than the original
data. Therefore, it is also called message digest or
message compression algorithm.
• Hash algorithms are designed to be collisiaon-resistant,
meaning that there is a very low probability that the same
string would be created for different data.
One-way Hash Function
• The notion of a one-way function is central to public-key
cryptography.
• A one-way hash function is a mathematical function which
takes a variable-length input string (called pre-image) and
converts it into a fixed-length binary sequence (called
hash value).
• It is also known as a message digest, fingerprint or
compression function
• Furthermore, a one-way hash function is designed in such
a way that it is hard to reverse the process, that is, it is
easy to compute a hash value from pre-image but it is
hard to generate a pre-image that hashes to a particular
value.
Hash Function
Fundamentally, Hashing is defined by
two distinct characteristics
Irreversibility Uniqueness
7
Hash Algorithms in Mac
1. Open Terminal
2. Write the hash algorithm “MD5 or SHASUM”
3. Add the file path or drag and drop the file into the
terminal
• Note that the hash algorith remains the same, unliss the file was
updated
• The hash length depends on the hash alorithm
• MD5 has a length of 128 bits
Hash Algorithms in Mac
HASH for Windows
10
Using Command Prompt
Open a command line prompt. To do this, click the Start menu button
and type "cmd" (without the quotation marks). The words "Command
Prompt" should appear at the top of the menu. Click it to run it.
You will see a black window with a title bar that says "Command
Prompt", and a blinking text cursor just after words that say something
like "c:\Users\User>" somewhere in the window. (The exact words will
not be the same, since your Windows account name will probably be
different from mine.)
11
• Now navigate to the directory or folder where you have placed your file.
If your file is on the desktop, type "cd desktop" (without the quotation
marks) and hit the ENTER key. Otherwise, change directory by typing
"cd" followed by the full path.
12
• To use the Hash function, choose one of the hash
algorithms mentioned in slide 10. and write the command
as shown below:
• Now open the same file. ADD only one space to the first line. Go back
to the command prompt and write the same function. What do notice!
Chapter 1 - Introduction 13
Try different hash algorithm..
14