SlideShare a Scribd company logo
Hashes
A GUIDE TO HASHES (AND SALTED HASHES) IN IT SECURITY
CLARE JOHNSON
What are hashes?
 Hashes are mathematical functions (or algorithms) that take a string
of data of a variable length and turn it into a numeric string of fixed
length
Text input of
variable length
Numeric output
of fixed length
Examples
 Any amount of data is converted to a fixed-length “fingerprint”
 Cannot be reversed
 Any change in the input results in a completely different hash.
hash("hello") = 2cf24dba5fb0a30e26e83b2ac5b9e29e1b161e5c1fa7425e73043362938b9824
hash("hbllo") = 58756879c05c68dfac9866712fad6a93f8146f337a69afe7dd238f3364946366
hash("waltz") = c0e81794384491161f1777c232bc6bd9ec38f616560b120fda8e90f383853542
Why use hashes?
 Hashes are used in databases to make it easier / faster to search for
data
 We are interested in the hashes that are used for data encryption –
this may be:
 To store sensitive data in encrypted format
 To ensure integrity of data
Important Properties
 A hash is unique, but always repeatable
 The word ‘cat’ will hash to something that no other word will hash to,
but it will always hash to the same thing
 The function is one way
 If you are given the hash value for ‘cat’ you will never be able to
reverse hash it back to the word ‘cat’.
cat 9d989e8d27dc9e0ec3389fc855f142c3d40f0c50
Cryptographic Hash Functions
 Computationally infeasible to reverse
 SHA-1
 Produces a string of 160 bits
 Specification finalised in 1995
 MD5
 Quicker to compute than SHA-1
 Known to have been attacked
This is the process IN BRIEF for SHA-1
HOLD ON TO YOUR HATS…
Take your word and convert
 Original word
 Cat
 Convert to ASCII
 99 97 116
 Convert ASCII codes to binary
 01100011 01100001 01110100
 Join together and add a 1 to the end
 0110001101100001011101001
Add a load of zeros…
 Your number divided by 512 must have a remainder of 448, so add
as many zeros as necessary to get a remainder of 448
 0110001101100001011101001
 My message length is 25 (8 * 3 +1)
 448 – 25 = 423
 Therefore, add 423 zeros to my message, then it will be 448 digits
long
 448 / 512 is 0 remainder 448
More padding is added
 The length of the original message is added next, but it must equal
64 bits, so in our case, as the length was 25, I add the binary of 25
(00011001) preceded by 56 zeros (because 8 digits plus 56 digits = 64
digits) to the end of my message.
 Looks like this:
 011000110110000101110100100000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000011001
Chunk and process
 Break the string into chunks of 512 (ours is already 512)
 Break the chunks into 16 x 32 bit words
 Extend each group of 16 words to 80 words via a looped
algorithm
 4 words selected
 XOR the words together eg
 a 1 and a zero becomes a 1 (1 + 0 = 1)
 a zero and a zero becomes a 0 (0 + 0 = 0)
 a 1 and a 1 becomes a 0 (1 + 1 = 0)
 a 0 and a 1 becomes a 1 (0 + 1 = 1)
Process further
 The new word is left rotated by 1
 The first character is removed and added to the end of the word
 The word is added to the next vacant slot (ie on the first loop this will
become word number 16) until there are 80 words in total
 A series of functions is carried out on each word, depending on the
number of the word (eg words 0-19 use function 1)
 Words are ‘added’ together, and additional digits are truncated.
 Convert back to hex
 9d989e8d27dc9e0ec3389fc855f142c3d40f0c50
 Voila!
Overview
 Example for account registration
1. User creates an account
2. Password is hashed and stored (as a hash) in the
database
3. When the user attempts to log in, the hash of the
password they enter is checked against the hash of
their real password
4. If the hashes match, the user is granted access.
5. Steps 3 and 4 repeat every time a user tries to log in.
Salted hashes
 Because hashing always generates the same code from
a given word or phrase, it is possible to crack passwords
by using brute force attacks using common passwords
 These attacks can be prevents by randomising hashing
by adding or prepending a random string, called a salt,
prior to hashing.
 Salts are stored in the user account database, along
with the hash.
 This renders lookup tables, reverse lookups etc useless.
References
The first website listed is the one mainly used in this presentation, where
you can hash your own word and see the exact process in action
 http://www.metamorphosite.com/one-way-hash-encryption-sha1-
data-software, accessed 8/10/15
 https://crackstation.net/hashing-security.htm, accessed 12/10/15
 http://nvlpubs.nist.gov/nistpubs/FIPS/NIST.FIPS.180-4.pdf, accessed
14/10/15 (the official Federal Information Processing Standard)
 Images sourced from Google for educational purposes only

More Related Content

Viewers also liked

Cryptography Ashik
Cryptography AshikCryptography Ashik
Cryptography Ashik
Ashik Iqbal
 
Cryprography Assignment
Cryprography AssignmentCryprography Assignment
Cryprography Assignment
Ashik Iqbal
 
Hashing
HashingHashing
Secure Hash Algorithm (SHA-512)
Secure Hash Algorithm (SHA-512)Secure Hash Algorithm (SHA-512)
Secure Hash Algorithm (SHA-512)
DUET
 
Secure Hash Algorithm
Secure Hash AlgorithmSecure Hash Algorithm
Secure Hash Algorithm
Vishakha Agarwal
 
Hash Function & Analysis
Hash Function & AnalysisHash Function & Analysis
Hash Function & Analysis
Pawandeep Kaur
 
Apriori algorithm
Apriori algorithmApriori algorithm
Apriori algorithm
nouraalkhatib
 

Viewers also liked (8)

Cryptography Ashik
Cryptography AshikCryptography Ashik
Cryptography Ashik
 
Cryprography Assignment
Cryprography AssignmentCryprography Assignment
Cryprography Assignment
 
Hashing
HashingHashing
Hashing
 
Secure Hash Algorithm (SHA-512)
Secure Hash Algorithm (SHA-512)Secure Hash Algorithm (SHA-512)
Secure Hash Algorithm (SHA-512)
 
Secure Hash Algorithm
Secure Hash AlgorithmSecure Hash Algorithm
Secure Hash Algorithm
 
Hash Function & Analysis
Hash Function & AnalysisHash Function & Analysis
Hash Function & Analysis
 
allianceonline : Requesting TAC
allianceonline : Requesting TACallianceonline : Requesting TAC
allianceonline : Requesting TAC
 
Apriori algorithm
Apriori algorithmApriori algorithm
Apriori algorithm
 

Similar to Hash algorithms in IT security

Data streaming algorithms
Data streaming algorithmsData streaming algorithms
Data streaming algorithms
Hridyesh Bisht
 
Sha
ShaSha
Sha
ha123
 
AES by example
AES by exampleAES by example
AES by example
Shiraz316
 
The easiest consistent hashing
The easiest consistent hashingThe easiest consistent hashing
The easiest consistent hashing
DaeMyung Kang
 
P@ssw0rds
P@ssw0rdsP@ssw0rds
P@ssw0rds
Will Alexander
 
Implementation of rainbow tables to crack md5 codes
Implementation of rainbow tables to crack md5 codesImplementation of rainbow tables to crack md5 codes
Implementation of rainbow tables to crack md5 codes
Khadidja BOUKREDIMI
 
Renas Rajab Asaad
Renas Rajab AsaadRenas Rajab Asaad
Renas Rajab Asaad
Renas Rekany
 
Number system
Number system Number system
Number system
Anirban Saha Anik
 
Basics of Cryptography - Stream ciphers and PRNG
Basics of Cryptography - Stream ciphers and PRNGBasics of Cryptography - Stream ciphers and PRNG
Basics of Cryptography - Stream ciphers and PRNG
julien pauli
 
Cryptography - Simplified - Hash Functions
Cryptography - Simplified - Hash FunctionsCryptography - Simplified - Hash Functions
Cryptography - Simplified - Hash Functions
Abdul Manaf Vellakodath
 
Data Structure and Algorithms: What is Hash Table ppt
Data Structure and Algorithms: What is Hash Table pptData Structure and Algorithms: What is Hash Table ppt
Data Structure and Algorithms: What is Hash Table ppt
JUSTFUN40
 
Modern Block Cipher- Modern Symmetric-Key Cipher
Modern Block Cipher- Modern Symmetric-Key CipherModern Block Cipher- Modern Symmetric-Key Cipher
Modern Block Cipher- Modern Symmetric-Key Cipher
Mahbubur Rahman
 
Sha-1 Collision
Sha-1 CollisionSha-1 Collision
Sha-1 Collision
University of South Wales
 
Secure Hashing Techniques - Introduction
Secure Hashing Techniques - IntroductionSecure Hashing Techniques - Introduction
Secure Hashing Techniques - Introduction
Udhayyagethan Mano
 
6_2018_11_23!09_24_56_PM (1).pptx
6_2018_11_23!09_24_56_PM (1).pptx6_2018_11_23!09_24_56_PM (1).pptx
6_2018_11_23!09_24_56_PM (1).pptx
HebaEng
 
SHA
SHASHA
Number System and Boolean Algebra
Number System and Boolean AlgebraNumber System and Boolean Algebra
Number System and Boolean Algebra
AMIE(I) Study Circle
 
Block Encryption Algorithm Project.docx
Block Encryption Algorithm Project.docxBlock Encryption Algorithm Project.docx
Block Encryption Algorithm Project.docx
UsamaAliLone3
 
Computer data representation (integers, floating-point numbers, text, images,...
Computer data representation (integers, floating-point numbers, text, images,...Computer data representation (integers, floating-point numbers, text, images,...
Computer data representation (integers, floating-point numbers, text, images,...
ArtemKovera
 
Binary, Decimal and Hexadecimal
Binary, Decimal and HexadecimalBinary, Decimal and Hexadecimal
Binary, Decimal and Hexadecimal
UthraSowrirajan1
 

Similar to Hash algorithms in IT security (20)

Data streaming algorithms
Data streaming algorithmsData streaming algorithms
Data streaming algorithms
 
Sha
ShaSha
Sha
 
AES by example
AES by exampleAES by example
AES by example
 
The easiest consistent hashing
The easiest consistent hashingThe easiest consistent hashing
The easiest consistent hashing
 
P@ssw0rds
P@ssw0rdsP@ssw0rds
P@ssw0rds
 
Implementation of rainbow tables to crack md5 codes
Implementation of rainbow tables to crack md5 codesImplementation of rainbow tables to crack md5 codes
Implementation of rainbow tables to crack md5 codes
 
Renas Rajab Asaad
Renas Rajab AsaadRenas Rajab Asaad
Renas Rajab Asaad
 
Number system
Number system Number system
Number system
 
Basics of Cryptography - Stream ciphers and PRNG
Basics of Cryptography - Stream ciphers and PRNGBasics of Cryptography - Stream ciphers and PRNG
Basics of Cryptography - Stream ciphers and PRNG
 
Cryptography - Simplified - Hash Functions
Cryptography - Simplified - Hash FunctionsCryptography - Simplified - Hash Functions
Cryptography - Simplified - Hash Functions
 
Data Structure and Algorithms: What is Hash Table ppt
Data Structure and Algorithms: What is Hash Table pptData Structure and Algorithms: What is Hash Table ppt
Data Structure and Algorithms: What is Hash Table ppt
 
Modern Block Cipher- Modern Symmetric-Key Cipher
Modern Block Cipher- Modern Symmetric-Key CipherModern Block Cipher- Modern Symmetric-Key Cipher
Modern Block Cipher- Modern Symmetric-Key Cipher
 
Sha-1 Collision
Sha-1 CollisionSha-1 Collision
Sha-1 Collision
 
Secure Hashing Techniques - Introduction
Secure Hashing Techniques - IntroductionSecure Hashing Techniques - Introduction
Secure Hashing Techniques - Introduction
 
6_2018_11_23!09_24_56_PM (1).pptx
6_2018_11_23!09_24_56_PM (1).pptx6_2018_11_23!09_24_56_PM (1).pptx
6_2018_11_23!09_24_56_PM (1).pptx
 
SHA
SHASHA
SHA
 
Number System and Boolean Algebra
Number System and Boolean AlgebraNumber System and Boolean Algebra
Number System and Boolean Algebra
 
Block Encryption Algorithm Project.docx
Block Encryption Algorithm Project.docxBlock Encryption Algorithm Project.docx
Block Encryption Algorithm Project.docx
 
Computer data representation (integers, floating-point numbers, text, images,...
Computer data representation (integers, floating-point numbers, text, images,...Computer data representation (integers, floating-point numbers, text, images,...
Computer data representation (integers, floating-point numbers, text, images,...
 
Binary, Decimal and Hexadecimal
Binary, Decimal and HexadecimalBinary, Decimal and Hexadecimal
Binary, Decimal and Hexadecimal
 

Recently uploaded

Overview on Edible Vaccine: Pros & Cons with Mechanism
Overview on Edible Vaccine: Pros & Cons with MechanismOverview on Edible Vaccine: Pros & Cons with Mechanism
Overview on Edible Vaccine: Pros & Cons with Mechanism
DeeptiGupta154
 
Unit 8 - Information and Communication Technology (Paper I).pdf
Unit 8 - Information and Communication Technology (Paper I).pdfUnit 8 - Information and Communication Technology (Paper I).pdf
Unit 8 - Information and Communication Technology (Paper I).pdf
Thiyagu K
 
Basic phrases for greeting and assisting costumers
Basic phrases for greeting and assisting costumersBasic phrases for greeting and assisting costumers
Basic phrases for greeting and assisting costumers
PedroFerreira53928
 
Digital Tools and AI for Teaching Learning and Research
Digital Tools and AI for Teaching Learning and ResearchDigital Tools and AI for Teaching Learning and Research
Digital Tools and AI for Teaching Learning and Research
Vikramjit Singh
 
The Art Pastor's Guide to Sabbath | Steve Thomason
The Art Pastor's Guide to Sabbath | Steve ThomasonThe Art Pastor's Guide to Sabbath | Steve Thomason
The Art Pastor's Guide to Sabbath | Steve Thomason
Steve Thomason
 
Cambridge International AS A Level Biology Coursebook - EBook (MaryFosbery J...
Cambridge International AS  A Level Biology Coursebook - EBook (MaryFosbery J...Cambridge International AS  A Level Biology Coursebook - EBook (MaryFosbery J...
Cambridge International AS A Level Biology Coursebook - EBook (MaryFosbery J...
AzmatAli747758
 
Operation Blue Star - Saka Neela Tara
Operation Blue Star   -  Saka Neela TaraOperation Blue Star   -  Saka Neela Tara
Operation Blue Star - Saka Neela Tara
Balvir Singh
 
Home assignment II on Spectroscopy 2024 Answers.pdf
Home assignment II on Spectroscopy 2024 Answers.pdfHome assignment II on Spectroscopy 2024 Answers.pdf
Home assignment II on Spectroscopy 2024 Answers.pdf
Tamralipta Mahavidyalaya
 
CLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCE
CLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCECLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCE
CLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCE
BhavyaRajput3
 
Palestine last event orientationfvgnh .pptx
Palestine last event orientationfvgnh .pptxPalestine last event orientationfvgnh .pptx
Palestine last event orientationfvgnh .pptx
RaedMohamed3
 
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
siemaillard
 
Template Jadual Bertugas Kelas (Boleh Edit)
Template Jadual Bertugas Kelas (Boleh Edit)Template Jadual Bertugas Kelas (Boleh Edit)
Template Jadual Bertugas Kelas (Boleh Edit)
rosedainty
 
Fish and Chips - have they had their chips
Fish and Chips - have they had their chipsFish and Chips - have they had their chips
Fish and Chips - have they had their chips
GeoBlogs
 
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
MysoreMuleSoftMeetup
 
PART A. Introduction to Costumer Service
PART A. Introduction to Costumer ServicePART A. Introduction to Costumer Service
PART A. Introduction to Costumer Service
PedroFerreira53928
 
MARUTI SUZUKI- A Successful Joint Venture in India.pptx
MARUTI SUZUKI- A Successful Joint Venture in India.pptxMARUTI SUZUKI- A Successful Joint Venture in India.pptx
MARUTI SUZUKI- A Successful Joint Venture in India.pptx
bennyroshan06
 
The approach at University of Liverpool.pptx
The approach at University of Liverpool.pptxThe approach at University of Liverpool.pptx
The approach at University of Liverpool.pptx
Jisc
 
Synthetic Fiber Construction in lab .pptx
Synthetic Fiber Construction in lab .pptxSynthetic Fiber Construction in lab .pptx
Synthetic Fiber Construction in lab .pptx
Pavel ( NSTU)
 
special B.ed 2nd year old paper_20240531.pdf
special B.ed 2nd year old paper_20240531.pdfspecial B.ed 2nd year old paper_20240531.pdf
special B.ed 2nd year old paper_20240531.pdf
Special education needs
 
The Roman Empire A Historical Colossus.pdf
The Roman Empire A Historical Colossus.pdfThe Roman Empire A Historical Colossus.pdf
The Roman Empire A Historical Colossus.pdf
kaushalkr1407
 

Recently uploaded (20)

Overview on Edible Vaccine: Pros & Cons with Mechanism
Overview on Edible Vaccine: Pros & Cons with MechanismOverview on Edible Vaccine: Pros & Cons with Mechanism
Overview on Edible Vaccine: Pros & Cons with Mechanism
 
Unit 8 - Information and Communication Technology (Paper I).pdf
Unit 8 - Information and Communication Technology (Paper I).pdfUnit 8 - Information and Communication Technology (Paper I).pdf
Unit 8 - Information and Communication Technology (Paper I).pdf
 
Basic phrases for greeting and assisting costumers
Basic phrases for greeting and assisting costumersBasic phrases for greeting and assisting costumers
Basic phrases for greeting and assisting costumers
 
Digital Tools and AI for Teaching Learning and Research
Digital Tools and AI for Teaching Learning and ResearchDigital Tools and AI for Teaching Learning and Research
Digital Tools and AI for Teaching Learning and Research
 
The Art Pastor's Guide to Sabbath | Steve Thomason
The Art Pastor's Guide to Sabbath | Steve ThomasonThe Art Pastor's Guide to Sabbath | Steve Thomason
The Art Pastor's Guide to Sabbath | Steve Thomason
 
Cambridge International AS A Level Biology Coursebook - EBook (MaryFosbery J...
Cambridge International AS  A Level Biology Coursebook - EBook (MaryFosbery J...Cambridge International AS  A Level Biology Coursebook - EBook (MaryFosbery J...
Cambridge International AS A Level Biology Coursebook - EBook (MaryFosbery J...
 
Operation Blue Star - Saka Neela Tara
Operation Blue Star   -  Saka Neela TaraOperation Blue Star   -  Saka Neela Tara
Operation Blue Star - Saka Neela Tara
 
Home assignment II on Spectroscopy 2024 Answers.pdf
Home assignment II on Spectroscopy 2024 Answers.pdfHome assignment II on Spectroscopy 2024 Answers.pdf
Home assignment II on Spectroscopy 2024 Answers.pdf
 
CLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCE
CLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCECLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCE
CLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCE
 
Palestine last event orientationfvgnh .pptx
Palestine last event orientationfvgnh .pptxPalestine last event orientationfvgnh .pptx
Palestine last event orientationfvgnh .pptx
 
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
 
Template Jadual Bertugas Kelas (Boleh Edit)
Template Jadual Bertugas Kelas (Boleh Edit)Template Jadual Bertugas Kelas (Boleh Edit)
Template Jadual Bertugas Kelas (Boleh Edit)
 
Fish and Chips - have they had their chips
Fish and Chips - have they had their chipsFish and Chips - have they had their chips
Fish and Chips - have they had their chips
 
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
 
PART A. Introduction to Costumer Service
PART A. Introduction to Costumer ServicePART A. Introduction to Costumer Service
PART A. Introduction to Costumer Service
 
MARUTI SUZUKI- A Successful Joint Venture in India.pptx
MARUTI SUZUKI- A Successful Joint Venture in India.pptxMARUTI SUZUKI- A Successful Joint Venture in India.pptx
MARUTI SUZUKI- A Successful Joint Venture in India.pptx
 
The approach at University of Liverpool.pptx
The approach at University of Liverpool.pptxThe approach at University of Liverpool.pptx
The approach at University of Liverpool.pptx
 
Synthetic Fiber Construction in lab .pptx
Synthetic Fiber Construction in lab .pptxSynthetic Fiber Construction in lab .pptx
Synthetic Fiber Construction in lab .pptx
 
special B.ed 2nd year old paper_20240531.pdf
special B.ed 2nd year old paper_20240531.pdfspecial B.ed 2nd year old paper_20240531.pdf
special B.ed 2nd year old paper_20240531.pdf
 
The Roman Empire A Historical Colossus.pdf
The Roman Empire A Historical Colossus.pdfThe Roman Empire A Historical Colossus.pdf
The Roman Empire A Historical Colossus.pdf
 

Hash algorithms in IT security

  • 1. Hashes A GUIDE TO HASHES (AND SALTED HASHES) IN IT SECURITY CLARE JOHNSON
  • 2. What are hashes?  Hashes are mathematical functions (or algorithms) that take a string of data of a variable length and turn it into a numeric string of fixed length Text input of variable length Numeric output of fixed length
  • 3. Examples  Any amount of data is converted to a fixed-length “fingerprint”  Cannot be reversed  Any change in the input results in a completely different hash. hash("hello") = 2cf24dba5fb0a30e26e83b2ac5b9e29e1b161e5c1fa7425e73043362938b9824 hash("hbllo") = 58756879c05c68dfac9866712fad6a93f8146f337a69afe7dd238f3364946366 hash("waltz") = c0e81794384491161f1777c232bc6bd9ec38f616560b120fda8e90f383853542
  • 4. Why use hashes?  Hashes are used in databases to make it easier / faster to search for data  We are interested in the hashes that are used for data encryption – this may be:  To store sensitive data in encrypted format  To ensure integrity of data
  • 5. Important Properties  A hash is unique, but always repeatable  The word ‘cat’ will hash to something that no other word will hash to, but it will always hash to the same thing  The function is one way  If you are given the hash value for ‘cat’ you will never be able to reverse hash it back to the word ‘cat’. cat 9d989e8d27dc9e0ec3389fc855f142c3d40f0c50
  • 6. Cryptographic Hash Functions  Computationally infeasible to reverse  SHA-1  Produces a string of 160 bits  Specification finalised in 1995  MD5  Quicker to compute than SHA-1  Known to have been attacked
  • 7. This is the process IN BRIEF for SHA-1 HOLD ON TO YOUR HATS…
  • 8. Take your word and convert  Original word  Cat  Convert to ASCII  99 97 116  Convert ASCII codes to binary  01100011 01100001 01110100  Join together and add a 1 to the end  0110001101100001011101001
  • 9. Add a load of zeros…  Your number divided by 512 must have a remainder of 448, so add as many zeros as necessary to get a remainder of 448  0110001101100001011101001  My message length is 25 (8 * 3 +1)  448 – 25 = 423  Therefore, add 423 zeros to my message, then it will be 448 digits long  448 / 512 is 0 remainder 448
  • 10. More padding is added  The length of the original message is added next, but it must equal 64 bits, so in our case, as the length was 25, I add the binary of 25 (00011001) preceded by 56 zeros (because 8 digits plus 56 digits = 64 digits) to the end of my message.  Looks like this:  011000110110000101110100100000000000000000000000000000000000000000 000000000000000000000000000000000000000000000000000000000000000000 000000000000000000000000000000000000000000000000000000000000000000 000000000000000000000000000000000000000000000000000000000000000000 000000000000000000000000000000000000000000000000000000000000000000 000000000000000000000000000000000000000000000000000000000000000000 000000000000000000000000000000000000000000000000000000000000000000 00000000000000000000000000000000000000000000011001
  • 11. Chunk and process  Break the string into chunks of 512 (ours is already 512)  Break the chunks into 16 x 32 bit words  Extend each group of 16 words to 80 words via a looped algorithm  4 words selected  XOR the words together eg  a 1 and a zero becomes a 1 (1 + 0 = 1)  a zero and a zero becomes a 0 (0 + 0 = 0)  a 1 and a 1 becomes a 0 (1 + 1 = 0)  a 0 and a 1 becomes a 1 (0 + 1 = 1)
  • 12. Process further  The new word is left rotated by 1  The first character is removed and added to the end of the word  The word is added to the next vacant slot (ie on the first loop this will become word number 16) until there are 80 words in total  A series of functions is carried out on each word, depending on the number of the word (eg words 0-19 use function 1)  Words are ‘added’ together, and additional digits are truncated.  Convert back to hex  9d989e8d27dc9e0ec3389fc855f142c3d40f0c50  Voila!
  • 13. Overview  Example for account registration 1. User creates an account 2. Password is hashed and stored (as a hash) in the database 3. When the user attempts to log in, the hash of the password they enter is checked against the hash of their real password 4. If the hashes match, the user is granted access. 5. Steps 3 and 4 repeat every time a user tries to log in.
  • 14. Salted hashes  Because hashing always generates the same code from a given word or phrase, it is possible to crack passwords by using brute force attacks using common passwords  These attacks can be prevents by randomising hashing by adding or prepending a random string, called a salt, prior to hashing.  Salts are stored in the user account database, along with the hash.  This renders lookup tables, reverse lookups etc useless.
  • 15. References The first website listed is the one mainly used in this presentation, where you can hash your own word and see the exact process in action  http://www.metamorphosite.com/one-way-hash-encryption-sha1- data-software, accessed 8/10/15  https://crackstation.net/hashing-security.htm, accessed 12/10/15  http://nvlpubs.nist.gov/nistpubs/FIPS/NIST.FIPS.180-4.pdf, accessed 14/10/15 (the official Federal Information Processing Standard)  Images sourced from Google for educational purposes only

Editor's Notes

  1. Please note that some of the steps in this walkthrough are deliberately vague – the aim of this presentation is to give an overview into the process, rather than to provide explicit instructions on how to process a hash algorithm. The presentation is aimed at Level 4 / Level 5 Foundation Degree students. References to websites consulted are provided at the end.