SlideShare a Scribd company logo
2
Most read
11
Most read
17
Most read
Recommendation on
Password Hashing,
Salting, Bycrpt
Ahmad Karawash
PhD in Technology of Information, Book Editor,
CCA, Latece, ACM & IEEE member
12/18/2015 1
Overview
• Introduction
• Hashing
• Fixed Salting
• Per user Salting
• Bcrypting
• Recommendations
12/18/2015 2
Introduction
• The most important aspect of a user account system is how user
passwords are protected.
• User account databases are hacked frequently, so you absolutely
must do something to protect your users' passwords if your website is
ever breached.
• The best way to protect passwords is to employ salted password
hashing.
12/18/2015 3
Hashing
• Hashing is the transformation of a string of characters into a usually
shorter fixed-length value or key that represents the original string.
• Fast Hashing Algorithms:
• Md5
• Sha1
• sha256
12/18/2015 4
Username sha1(password)
john@hotmail.com 5baa61e4c9b93f3f0682250b6cf8331b7ee68fd8
betty@gmail.com cbfdac6008f9cab4083784cbd1874f76618d2a97
…. …..
How password hashing works?
• The user creates an account.
• Their password is hashed and stored in the database.
• When the user attempts to login, the hash of the password they
entered is checked against the hash of their real password (retrieved
from the database).
• If the hashes match, the user is granted access. If not, the user is told
they entered invalid login credentials.
• Steps 3 and 4 repeat every time someone tries to login to their
account.
12/18/2015 5
Weakness: How password hashing
is hacked?
The simplest way to crack a hash is to try to guess the password, hashing
each guess, and checking if the guess's hash equals the hash being cracked.
The two most common ways of guessing passwords are
• Dictionary Attacks
• Brute Force Attacks
• Lookup Tables
• Reverse Lookup Tables
• Rainbow Tables
12/18/2015 6
Hashing result
• Storing a simple hash is not secure -- if a hacker gains access to your
database, they'll be able to figure out the majority of the passwords
of the users.
12/18/2015 7
1st Enhancement: Adding Fixed Salt
to fast hashing
• Randomize the hashes by appending a random long string, called
a salt, to the password before hashing.
• If the hacker gains access to password hashes (but not the salt), it will
make it much more difficult for the hacker to guess the passwords
because they would also need to know the salt.
12/18/2015 8
Username sha1("salt123456789" + password)
john@hotmail.com 5baa61e4c9b93f3f0682250b6cf8331b7ee68fd8
betty@gmail.com cbfdac6008f9cab4083784cbd1874f76618d2a97
…. …..
Weakness of fixed salt
• if the hacker has broken into your server, they probably also have
access to your source code as well, so they'll learn the salt too.
12/18/2015 9
2nd Enhancement: Add Per_User
Salt to fast hashing
• Create a new column in the database and store a different salt for
each user. The salt is randomly created when the user account is first
created when the user changes their password.
12/18/2015 10
Username sha1("salt" + password) salt
john@hotmail.com 5baa61e4c9b93f3f0682250b6cf8331b7ee68fd8 3r3erererwe3
betty@gmail.com cbfdac6008f9cab4083784cbd1874f76618d2a97 effe4f34w3fg3
…. ….. …..
Benefit of Per_User salt
• The hacker can't attack all of your user's passwords at the same time
• So basically, if you have 1 million users, having a per-user-salt makes it
1 million times harder to figure out the passwords of all your users.
• But this still isn't impossible for a hacker to do. Instead of 1 cpu-hour,
now they need 1 million cpu-hours, which can easily be rented from
Amazon for about $40,000.
12/18/2015 11
3rd enhancement: USE Bcrypt OR
PBKDF2 for Slow HAshing
• Bcrypt is a cross platform file encryption utility.
• It takes about 100ms to compute, which is about 10,000x slower than
sha1(). 100ms is fast enough that the user won't notice when they log
in, but slow enough that it becomes less feasible to execute against a
long list of likely passwords.
• For instance, if a hacker wants to compute bcrypt() against a list of a
billion likely passwords, it will take about 30,000 cpu-hours (in AWS
about $1200) -- and that's for a single password.
12/18/2015 12
benefits
• Besides incorporating a salt to protect against rainbow table attacks,
Bcrypt & PBKDF2 is an adaptive function: over time, the iteration
count can be increased to make it slower, so it remains resistant
to brute-force search attacks even with increasing computation
power.
12/18/2015 13
Username $bcrypt_id$Log_rounds$128-bit-salt 184-bit-hash
john@hotmail.com $2a$12$ffdfd5baa61e4c9b93f3f0682250b6cf8331b7ee68fd8
betty@gmail.com $3d$12$cbfdac6008f9cab4083784cbd1874f76618d2a97ffdfr
…. …..
Recommendation
• Don’t use any of these Fast Hashing Algorithms:
• Md5
• Sha1
• sha256
• Also, the web is full of bad recommendation about using these
hashing functions.
12/18/2015 14
Recommendation
• Bcrypt or PBKDF2 are better even if they are slower.
• Slower does not means it will be noticed by the client (only 100 ms).
• You can control the hashing speed easily by providing the log_rounds
value, because it apply a loop of successive hashing by a maximum of
13 round.
12/18/2015 15
Recommendation
1. USE a slow hashing functions like Bcript
2. Create a new column in different (or same) database to store a
different salt for each user.
• The salt is randomly created when the user account is first created
when the user changes their password.
• Proposed Result:
• Attacker face a slow hashing
• Attacker can’t hack all password once, but one by one in the worst case.
12/18/2015 16
Recommendation
12/18/2015 17
Id_S1 Username $bcrypt_id$Log_rounds$128-bit-
salt 184-bit-hash
Id_S2
1
john@hotmail.c
om
$5b$12$aa61e4c9b93f3682250b6cf 2
2
betty@gmail.co
m $cb$12$fdac6008f9cu4083784cb78u 1
…. …. …..
Id_S2 Different_salt
1 3r3erererwe3
2
effe4f34w3fg3
….. ….
Table Salt
Table Advanced Salt
DB 2
DB 1
?? @:
Ahmad.Karawash@gmail.com
12/18/2015 18

More Related Content

PDF
Password Security and Use of John the Ripper Tool
Neranjan Viduranga
 
PDF
Chapter 1 Introduction to AI.pdf
esuEthopi
 
PPTX
Brute force-attack presentation
Mahmoud Ibra
 
PPTX
AIML Introduction
Nguyen Giang
 
PDF
Password (in)security
Enrico Zimuel
 
PDF
Human Factors in Cyber Security: User authentication as a use case
Shujun Li
 
PPTX
Captcha seminar
Aurobindo Nayak
 
Password Security and Use of John the Ripper Tool
Neranjan Viduranga
 
Chapter 1 Introduction to AI.pdf
esuEthopi
 
Brute force-attack presentation
Mahmoud Ibra
 
AIML Introduction
Nguyen Giang
 
Password (in)security
Enrico Zimuel
 
Human Factors in Cyber Security: User authentication as a use case
Shujun Li
 
Captcha seminar
Aurobindo Nayak
 

What's hot (20)

ODP
An Introduction to Hashing and Salting
Rahul Singh
 
PPTX
Authentication methods
sana mateen
 
PPTX
Authentication
primeteacher32
 
PDF
HP WebInspect
rohit_ta
 
PPTX
Hashicorp Vault ppt
Shrey Agarwal
 
PDF
Broken access controls
Akansha Kesharwani
 
PDF
Secure Session Management
GuidePoint Security, LLC
 
PPTX
Http protocol
Arpita Naik
 
PPTX
SSRF For Bug Bounties
OWASP Nagpur
 
PDF
"15 Technique to Exploit File Upload Pages", Ebrahim Hegazy
HackIT Ukraine
 
PPTX
HTTP vs HTTPS Difference
Real Estate
 
PPTX
Rainbow Tables
Panggi Libersa
 
PDF
Ch 1: Web Application (In)security & Ch 2: Core Defense Mechanisms
Sam Bowne
 
PDF
Broken access control
Priyanshu Gandhi
 
PPTX
WiFi Secuiry: Attack & Defence
Prakashchand Suthar
 
PPTX
Introduction to Redis
Arnab Mitra
 
PPT
Intro to Web Application Security
Rob Ragan
 
PDF
Integration of Hive and HBase
Hortonworks
 
PPTX
Cryptography and network security
shraddha mane
 
An Introduction to Hashing and Salting
Rahul Singh
 
Authentication methods
sana mateen
 
Authentication
primeteacher32
 
HP WebInspect
rohit_ta
 
Hashicorp Vault ppt
Shrey Agarwal
 
Broken access controls
Akansha Kesharwani
 
Secure Session Management
GuidePoint Security, LLC
 
Http protocol
Arpita Naik
 
SSRF For Bug Bounties
OWASP Nagpur
 
"15 Technique to Exploit File Upload Pages", Ebrahim Hegazy
HackIT Ukraine
 
HTTP vs HTTPS Difference
Real Estate
 
Rainbow Tables
Panggi Libersa
 
Ch 1: Web Application (In)security & Ch 2: Core Defense Mechanisms
Sam Bowne
 
Broken access control
Priyanshu Gandhi
 
WiFi Secuiry: Attack & Defence
Prakashchand Suthar
 
Introduction to Redis
Arnab Mitra
 
Intro to Web Application Security
Rob Ragan
 
Integration of Hive and HBase
Hortonworks
 
Cryptography and network security
shraddha mane
 
Ad

Viewers also liked (8)

PDF
Message queues
Ahmad karawash
 
PDF
Proper passwordhashing
fangjiafu
 
PDF
Information system security wk4-2
Bee Lalita
 
ZIP
Hashing
Sri Prasanna
 
ODP
Disclosing password hashing policies
Michal Špaček
 
PPT
Hashing
grahamwell
 
PPT
Ch17 Hashing
leminhvuong
 
PPTX
Hashing Technique In Data Structures
SHAKOOR AB
 
Message queues
Ahmad karawash
 
Proper passwordhashing
fangjiafu
 
Information system security wk4-2
Bee Lalita
 
Hashing
Sri Prasanna
 
Disclosing password hashing policies
Michal Špaček
 
Hashing
grahamwell
 
Ch17 Hashing
leminhvuong
 
Hashing Technique In Data Structures
SHAKOOR AB
 
Ad

Similar to Password hashing, salting, bycrpt (20)

PDF
Passwords good badugly181212-2
Iftach Ian Amit
 
PDF
A Survey of Password Attacks and Safe Hashing Algorithms
IRJET Journal
 
PPTX
Password Storage Sucks!
nerdybeardo
 
PPT
Kieon secure passwords theory and practice 2011
Kieon
 
PPTX
Secure passwords-theory-and-practice
Akash Mahajan
 
PDF
Password Storage And Attacking In PHP - PHP Argentina
Anthony Ferrara
 
ODP
User Credential handling in Web Applications done right
tladesignz
 
PDF
Password Storage and Attacking in PHP
Anthony Ferrara
 
PPTX
Securing Passwords
Mandeep Singh
 
PDF
Protecting Your Clients' Privacy
Aijaz Ansari
 
PPTX
FYP1 Presentation
faeezfez
 
PPTX
A Recipe for Password Storage: Add Salt to Taste
Nick Malcolm
 
PDF
The slower the stronger a story of password hash migration
OWASP
 
PPTX
Hashing Considerations In Web Applications
Islam Heggo
 
PPTX
Storing passwords-honey words
kandulasindhu
 
ODP
All Your Password Are Belong To Us
Charles Southerland
 
PPTX
Techniques for password hashing and cracking
Nipun Joshi
 
PPTX
Password Storage Explained
jeetendra mandal
 
PPTX
P@ssw0rds
Will Alexander
 
PDF
IRJET- Login System for Web: Session Management using BCRYPTJS
IRJET Journal
 
Passwords good badugly181212-2
Iftach Ian Amit
 
A Survey of Password Attacks and Safe Hashing Algorithms
IRJET Journal
 
Password Storage Sucks!
nerdybeardo
 
Kieon secure passwords theory and practice 2011
Kieon
 
Secure passwords-theory-and-practice
Akash Mahajan
 
Password Storage And Attacking In PHP - PHP Argentina
Anthony Ferrara
 
User Credential handling in Web Applications done right
tladesignz
 
Password Storage and Attacking in PHP
Anthony Ferrara
 
Securing Passwords
Mandeep Singh
 
Protecting Your Clients' Privacy
Aijaz Ansari
 
FYP1 Presentation
faeezfez
 
A Recipe for Password Storage: Add Salt to Taste
Nick Malcolm
 
The slower the stronger a story of password hash migration
OWASP
 
Hashing Considerations In Web Applications
Islam Heggo
 
Storing passwords-honey words
kandulasindhu
 
All Your Password Are Belong To Us
Charles Southerland
 
Techniques for password hashing and cracking
Nipun Joshi
 
Password Storage Explained
jeetendra mandal
 
P@ssw0rds
Will Alexander
 
IRJET- Login System for Web: Session Management using BCRYPTJS
IRJET Journal
 

More from Ahmad karawash (9)

PDF
Object-Oriented Programming (OOP)
Ahmad karawash
 
PDF
Introduction to-data-science
Ahmad karawash
 
PDF
How to understand your data
Ahmad karawash
 
PPTX
Cloud storage with AWS
Ahmad karawash
 
PDF
Build a custom metrics on aws cloud
Ahmad karawash
 
PDF
Brute Force Attack
Ahmad karawash
 
PPTX
Reasoning of database consistency through description logics
Ahmad karawash
 
PPTX
Cloud computing and Service model
Ahmad karawash
 
PPTX
From use case to software architecture
Ahmad karawash
 
Object-Oriented Programming (OOP)
Ahmad karawash
 
Introduction to-data-science
Ahmad karawash
 
How to understand your data
Ahmad karawash
 
Cloud storage with AWS
Ahmad karawash
 
Build a custom metrics on aws cloud
Ahmad karawash
 
Brute Force Attack
Ahmad karawash
 
Reasoning of database consistency through description logics
Ahmad karawash
 
Cloud computing and Service model
Ahmad karawash
 
From use case to software architecture
Ahmad karawash
 

Recently uploaded (20)

PDF
Economic Impact of Data Centres to the Malaysian Economy
flintglobalapac
 
PPTX
Simple and concise overview about Quantum computing..pptx
mughal641
 
PPTX
Introduction to Flutter by Ayush Desai.pptx
ayushdesai204
 
PDF
Responsible AI and AI Ethics - By Sylvester Ebhonu
Sylvester Ebhonu
 
PPTX
The Future of AI & Machine Learning.pptx
pritsen4700
 
PPTX
New ThousandEyes Product Innovations: Cisco Live June 2025
ThousandEyes
 
PPTX
Applied-Statistics-Mastering-Data-Driven-Decisions.pptx
parmaryashparmaryash
 
PDF
SparkLabs Primer on Artificial Intelligence 2025
SparkLabs Group
 
PPTX
Agile Chennai 18-19 July 2025 | Emerging patterns in Agentic AI by Bharani Su...
AgileNetwork
 
PDF
Get More from Fiori Automation - What’s New, What Works, and What’s Next.pdf
Precisely
 
PDF
Structs to JSON: How Go Powers REST APIs
Emily Achieng
 
PDF
Peak of Data & AI Encore - Real-Time Insights & Scalable Editing with ArcGIS
Safe Software
 
PDF
OFFOFFBOX™ – A New Era for African Film | Startup Presentation
ambaicciwalkerbrian
 
PPTX
AI and Robotics for Human Well-being.pptx
JAYMIN SUTHAR
 
PDF
Research-Fundamentals-and-Topic-Development.pdf
ayesha butalia
 
PDF
Make GenAI investments go further with the Dell AI Factory
Principled Technologies
 
PDF
Brief History of Internet - Early Days of Internet
sutharharshit158
 
PPTX
OA presentation.pptx OA presentation.pptx
pateldhruv002338
 
PDF
MASTERDECK GRAPHSUMMIT SYDNEY (Public).pdf
Neo4j
 
PPTX
What-is-the-World-Wide-Web -- Introduction
tonifi9488
 
Economic Impact of Data Centres to the Malaysian Economy
flintglobalapac
 
Simple and concise overview about Quantum computing..pptx
mughal641
 
Introduction to Flutter by Ayush Desai.pptx
ayushdesai204
 
Responsible AI and AI Ethics - By Sylvester Ebhonu
Sylvester Ebhonu
 
The Future of AI & Machine Learning.pptx
pritsen4700
 
New ThousandEyes Product Innovations: Cisco Live June 2025
ThousandEyes
 
Applied-Statistics-Mastering-Data-Driven-Decisions.pptx
parmaryashparmaryash
 
SparkLabs Primer on Artificial Intelligence 2025
SparkLabs Group
 
Agile Chennai 18-19 July 2025 | Emerging patterns in Agentic AI by Bharani Su...
AgileNetwork
 
Get More from Fiori Automation - What’s New, What Works, and What’s Next.pdf
Precisely
 
Structs to JSON: How Go Powers REST APIs
Emily Achieng
 
Peak of Data & AI Encore - Real-Time Insights & Scalable Editing with ArcGIS
Safe Software
 
OFFOFFBOX™ – A New Era for African Film | Startup Presentation
ambaicciwalkerbrian
 
AI and Robotics for Human Well-being.pptx
JAYMIN SUTHAR
 
Research-Fundamentals-and-Topic-Development.pdf
ayesha butalia
 
Make GenAI investments go further with the Dell AI Factory
Principled Technologies
 
Brief History of Internet - Early Days of Internet
sutharharshit158
 
OA presentation.pptx OA presentation.pptx
pateldhruv002338
 
MASTERDECK GRAPHSUMMIT SYDNEY (Public).pdf
Neo4j
 
What-is-the-World-Wide-Web -- Introduction
tonifi9488
 

Password hashing, salting, bycrpt

  • 1. Recommendation on Password Hashing, Salting, Bycrpt Ahmad Karawash PhD in Technology of Information, Book Editor, CCA, Latece, ACM & IEEE member 12/18/2015 1
  • 2. Overview • Introduction • Hashing • Fixed Salting • Per user Salting • Bcrypting • Recommendations 12/18/2015 2
  • 3. Introduction • The most important aspect of a user account system is how user passwords are protected. • User account databases are hacked frequently, so you absolutely must do something to protect your users' passwords if your website is ever breached. • The best way to protect passwords is to employ salted password hashing. 12/18/2015 3
  • 4. Hashing • Hashing is the transformation of a string of characters into a usually shorter fixed-length value or key that represents the original string. • Fast Hashing Algorithms: • Md5 • Sha1 • sha256 12/18/2015 4 Username sha1(password) [email protected] 5baa61e4c9b93f3f0682250b6cf8331b7ee68fd8 [email protected] cbfdac6008f9cab4083784cbd1874f76618d2a97 …. …..
  • 5. How password hashing works? • The user creates an account. • Their password is hashed and stored in the database. • When the user attempts to login, the hash of the password they entered is checked against the hash of their real password (retrieved from the database). • If the hashes match, the user is granted access. If not, the user is told they entered invalid login credentials. • Steps 3 and 4 repeat every time someone tries to login to their account. 12/18/2015 5
  • 6. Weakness: How password hashing is hacked? The simplest way to crack a hash is to try to guess the password, hashing each guess, and checking if the guess's hash equals the hash being cracked. The two most common ways of guessing passwords are • Dictionary Attacks • Brute Force Attacks • Lookup Tables • Reverse Lookup Tables • Rainbow Tables 12/18/2015 6
  • 7. Hashing result • Storing a simple hash is not secure -- if a hacker gains access to your database, they'll be able to figure out the majority of the passwords of the users. 12/18/2015 7
  • 8. 1st Enhancement: Adding Fixed Salt to fast hashing • Randomize the hashes by appending a random long string, called a salt, to the password before hashing. • If the hacker gains access to password hashes (but not the salt), it will make it much more difficult for the hacker to guess the passwords because they would also need to know the salt. 12/18/2015 8 Username sha1("salt123456789" + password) [email protected] 5baa61e4c9b93f3f0682250b6cf8331b7ee68fd8 [email protected] cbfdac6008f9cab4083784cbd1874f76618d2a97 …. …..
  • 9. Weakness of fixed salt • if the hacker has broken into your server, they probably also have access to your source code as well, so they'll learn the salt too. 12/18/2015 9
  • 10. 2nd Enhancement: Add Per_User Salt to fast hashing • Create a new column in the database and store a different salt for each user. The salt is randomly created when the user account is first created when the user changes their password. 12/18/2015 10 Username sha1("salt" + password) salt [email protected] 5baa61e4c9b93f3f0682250b6cf8331b7ee68fd8 3r3erererwe3 [email protected] cbfdac6008f9cab4083784cbd1874f76618d2a97 effe4f34w3fg3 …. ….. …..
  • 11. Benefit of Per_User salt • The hacker can't attack all of your user's passwords at the same time • So basically, if you have 1 million users, having a per-user-salt makes it 1 million times harder to figure out the passwords of all your users. • But this still isn't impossible for a hacker to do. Instead of 1 cpu-hour, now they need 1 million cpu-hours, which can easily be rented from Amazon for about $40,000. 12/18/2015 11
  • 12. 3rd enhancement: USE Bcrypt OR PBKDF2 for Slow HAshing • Bcrypt is a cross platform file encryption utility. • It takes about 100ms to compute, which is about 10,000x slower than sha1(). 100ms is fast enough that the user won't notice when they log in, but slow enough that it becomes less feasible to execute against a long list of likely passwords. • For instance, if a hacker wants to compute bcrypt() against a list of a billion likely passwords, it will take about 30,000 cpu-hours (in AWS about $1200) -- and that's for a single password. 12/18/2015 12
  • 13. benefits • Besides incorporating a salt to protect against rainbow table attacks, Bcrypt & PBKDF2 is an adaptive function: over time, the iteration count can be increased to make it slower, so it remains resistant to brute-force search attacks even with increasing computation power. 12/18/2015 13 Username $bcrypt_id$Log_rounds$128-bit-salt 184-bit-hash [email protected] $2a$12$ffdfd5baa61e4c9b93f3f0682250b6cf8331b7ee68fd8 [email protected] $3d$12$cbfdac6008f9cab4083784cbd1874f76618d2a97ffdfr …. …..
  • 14. Recommendation • Don’t use any of these Fast Hashing Algorithms: • Md5 • Sha1 • sha256 • Also, the web is full of bad recommendation about using these hashing functions. 12/18/2015 14
  • 15. Recommendation • Bcrypt or PBKDF2 are better even if they are slower. • Slower does not means it will be noticed by the client (only 100 ms). • You can control the hashing speed easily by providing the log_rounds value, because it apply a loop of successive hashing by a maximum of 13 round. 12/18/2015 15
  • 16. Recommendation 1. USE a slow hashing functions like Bcript 2. Create a new column in different (or same) database to store a different salt for each user. • The salt is randomly created when the user account is first created when the user changes their password. • Proposed Result: • Attacker face a slow hashing • Attacker can’t hack all password once, but one by one in the worst case. 12/18/2015 16
  • 17. Recommendation 12/18/2015 17 Id_S1 Username $bcrypt_id$Log_rounds$128-bit- salt 184-bit-hash Id_S2 1 [email protected] om $5b$12$aa61e4c9b93f3682250b6cf 2 2 [email protected] m $cb$12$fdac6008f9cu4083784cb78u 1 …. …. ….. Id_S2 Different_salt 1 3r3erererwe3 2 effe4f34w3fg3 ….. …. Table Salt Table Advanced Salt DB 2 DB 1