0% found this document useful (0 votes)
7 views29 pages

Lecture-15 program to detect double space

The lecture introduces hash functions, explaining their operation, characteristics, and significance in information security and cryptography. Key concepts include the 'avalanche effect', uniqueness, irreversibility, and the distinction between hashing and encryption. It also covers common hash functions used in cryptocurrencies, particularly Bitcoin, and emphasizes the importance of hashing for data integrity.

Uploaded by

MUHAMMAD AHMAD
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
7 views29 pages

Lecture-15 program to detect double space

The lecture introduces hash functions, explaining their operation, characteristics, and significance in information security and cryptography. Key concepts include the 'avalanche effect', uniqueness, irreversibility, and the distinction between hashing and encryption. It also covers common hash functions used in cryptocurrencies, particularly Bitcoin, and emphasizes the importance of hashing for data integrity.

Uploaded by

MUHAMMAD AHMAD
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 29

Information Security

Lecture # 15

Dr. Shafiq Hussain


Associate Professor & Chairperson
Department of Computer Science

1
Objectives
• Introduction to Hash Functions.

2
Hash Functions
How Does a Hash Function Work?
• A hash function depends on the algorithm but
generally, to get the hash value of a set length, it
needs to first divide the input data into fixed-sized
blocks, which are called data blocks.

3
Hash Functions (Cont..)
• This is because a hash function takes in data at a
fixed length.

• The size of the data block is different from one


algorithm to another.

4
Hash Functions (Cont..)
• This is because a hash function takes in data at a
fixed length.

• The size of the data block is different from one


algorithm to another.

5
Hash Functions (Cont..)
• If the blocks are not big enough, they may add
padding to fill it out.

• However, regardless of what method of hashing you


use, the output, or hash value, is always the same
fixed length.

6
Hash Functions (Cont..)

7
Hash Functions (Cont..)
The “Avalanche Effect”:
• The data blocks are processed one at a time.

• The output of the first data block is fed as input along


with the second data block.

• Consequently, the output of the second is fed along


with the third block, and so on.

8
Hash Functions (Cont..)
The “Avalanche Effect”:
• Thus, making the final output the combined value of
all the blocks.

• If you change one bit anywhere in the message, the


entire hash value changes.

• This is called ‘the avalanche effect.

9
Hash Functions (Cont..)
Uniqueness and Deterministic:
• There should be no chance whatsoever that two
different message inputs create the same output hash.

• If a hash function produces the same output from two


different pieces of data, it is known as a “hash
collision,” and the algorithm is useless.

10
Hash Functions (Cont..)
Irreversibility:
• Ideally, hash functions should be irreversible.

• Meaning that while it is quick and easy to compute


the hash if you know the input message for any given
hash function, it is very difficult to go through the
process in reverse to compute the input message if
you only know the hash value.

11
Hash Functions (Cont..)

12
Hash Functions (Cont..)
Brute Force Search:
• However, it is possible to compute the input given the
output hash value, and that involves lots of
computing power.

• Computing from right to left is called a “brute force”


search, using trial and error to find a message that fits
the hash value and see if it produces a match.

13
Hash Functions (Cont..)
Hash Functions in Cryptography:
• The most famous cryptocurrency, Bitcoin, uses hash
functions in its blockchain.

• Powerful computers, called miners, race each other


in brute force searches to try to solve hashes in order
to earn the mining rewards of new Bitcoins.

14
Hash Functions (Cont..)
Hash Functions in Cryptography:
• Solving a hash involves computing a proof-of-work,
called a NONCE, or “number used once”, that,
when added to the block, causes the block’s hash to
begin with a certain number of zeroes.

• Once a valid proof-of-work is discovered, the block is


considered valid and can be added to the blockchain

15
Hash Functions (Cont..)
Hash Functions in Cryptography:
• Since each block’s hash is created by a cryptographic
algorithm – Bitcoin uses the SHA-256 algorithm –
the only way to find a valid proof-of-work is to run
guesses through the algorithm until the right number
is found that creates a hash that starts with the right
number of zeroes.

16
Hash Functions (Cont..)
Hash Functions in Cryptography:
• This is what Bitcoin miners are doing, running
numbers through a cryptographic algorithm until they
guess the valid NONCE.

17
Hash Functions (Cont..)
Common Cryptocurrency Hash Functions:
• The SHA-256 function that Bitcoin uses is short for
“Secure Hash Algorithm” and was designed by the
United States National Security Agency (NSA) and
includes SHA-1, SHA-2 (a family within a family
that includes SHA-224, SHA-256, SHA-384, and
SHA-512), and SHA-3 (SHA3-224, SHA3-256,
SHA3-384, and SHA3-512).

18
Hash Functions (Cont..)
Common Cryptocurrency Hash Functions:
• Message Digest (MD) Algorithm — MD2, MD4,
MD5, and MD6. MD5 was long considered a go-to
hashing algorithm, but it’s now considered broken
because of hash collisions.

19
Hash Functions (Cont..)
Common Cryptocurrency Hash Functions:
• Windows NTHash — Also known as a Unicode
hash or NTLM, this hash is commonly used by
Windows systems

20
Hash Functions (Cont..)
• Any piece of digital information, like a file on your
computer, a photo on your smartphone, or a block on
a cryptocurrency blockchain, has a hash. And each
hash is unique to each piece of data – any small
change in the underlying information will lead to a
completely different hash.

21
Hash Functions (Cont..)
Hashing vs Encryption:
• Encryption is the practice of taking data and creating
a scrambled message in a way that only someone
with a corresponding key, called a cipher, can
unscramble and decode it.

22
Hash Functions (Cont..)
Hashing vs Encryption:
• Encryption is a two-way function, designed to be
reversible by anyone who holds a cipher.

• So when someone encrypts something, it is done with


the intention of decrypting it later.

23
Hash Functions (Cont..)
Hashing vs Encryption:
• Hashing is using a formula that converts data of any
size to a fixed length.

• The computing power required to “un-hash”


something makes it very difficult so whereas
encryption is a two-way function, hashing is
generally a one-way function.

24
Hash Functions (Cont..)
Hashing vs Encryption:
• Encryption is meant to protect data in transit, hashing
is meant to verify that a file or piece of data hasn’t
been altered—that it is authentic.

25
Hash Functions (Cont..)
Hashing vs Encryption:
• Encryption is meant to protect data in transit, hashing
is meant to verify that a file or piece of data hasn’t
been altered—that it is authentic.

26
Questions
Any Question Please?

You can contact me at: [email protected]

Your Query will be answered within one working day.

27
Further Readings
• Chapter No. 1
Computer_Security_Principles_and_Practice_(3rd_E
dition)
By William Stallings and Lawrie Brown

28
Thanks

29

You might also like