What is the Argon2 function? (2024)

Argon2 is a cryptographic hashing algorithm specifically used to hash passwords. It provides better protection against password cracking than other hashing algorithms like Bcrypt, Scrypt, and PBKDF2.

Demonstration of working of Argon2 function

Variants

The argon2 function has three variants.

  1. Argon2i provides strong GPU resistance but has potential side-channel attacks.

  2. Argon2d Provides strong side-channel attack resistance.

  3. Argoin2id is the safest variant because it is a combination of the above two variants.

Parameters

  • memory_cost: the amount of memory in KB to be used.
  • password: password string to be hashed.
  • salt_len: length of random salt to be generated for each password.
  • parallelism: Number of parallel threads.
  • time_cost: Number of iterations over memory.
  • hash_len: Desired length of the output.
  • type: Argon2 variant to be used.

Code

import argon2

argon2Hasher = argon2.PasswordHasher(

time_cost=2,

memory_cost=64,

parallelism=1,

hash_len=16,

salt_len=16,

type = argon2.low_level.Type(2)

)

password = "@Educative123"

hash = argon2Hasher.hash(password)

print("Hashed password: ", hash)

Explanation

In the code above:

  • Line 1: we import the python argon2 module.
  • Line 3: we create an instance of the PasswordHasher class with custom parameters.
  • Line 9: we specify a variant of the argon2 function using the Type function of another argon2 class named low_level. Type IDs for argon2d, argon2i and argon2id are 0, 1, and 2 respectively.
  • Line 12: we declare the password string that we want to hash.
  • Line 14: we call the hash function with the password string.

Note: Output hash changes every time you press the Run button. This is because randomly generated salt changes every time the hash function is called.

Copyright ©2024 Educative, Inc. All rights reserved

What is the Argon2 function? (2024)

FAQs

What is the Argon2 function? ›

Argon2 is a memory-hard

memory-hard
In cryptography, a memory-hard function (MHF) is a function that costs a significant amount of memory to efficiently evaluate. It differs from a memory-bound function, which incurs cost by slowing down computation through memory latency.
https://en.wikipedia.org › wiki › Memory-hard_function
password hashing function which can be used to hash passwords for credential storage, key derivation, or other applications. Argon2 has the following three variants (Argon2i is the default): Argon2d - suitable for applications with no threats from side-channel timing attacks (eg.

What are the benefits of Argon2? ›

Argon2 is a great memory-hard password hashing algorithm, which makes it good for offline key derivation. But it requires more time, which, for web applications is less ideal. bcrypt can deliver hashing times under 1 second long, but does not include parameters like threads, CPU, or memory hardness.

Where is Argon2 used? ›

Argon2 is a cryptographic hashing algorithm specifically used to hash passwords. It provides better protection against password cracking than other hashing algorithms like Bcrypt, Scrypt, and PBKDF2. The Argon2 function takes in the password and outputs the hash of the specified length.

Why is Argon2 better than bcrypt? ›

Argon2: Considered the most secure among the four, especially against GPU and ASIC attacks. Its memory hardness and configurability make it highly resistant to various attack vectors. bcrypt: Still considered secure, but potentially vulnerable to FPGA attacks.

How does Argon2i work? ›

It accesses the memory array in a password dependent order, which reduces the possibility of time–memory trade-off (TMTO) attacks, but introduces possible side-channel attacks. Argon2i is optimized to resist side-channel attacks. It accesses the memory array in a password independent order.

What is the function of Argon2? ›

Argon2 is a memory-hard password hashing function which can be used to hash passwords for credential storage, key derivation, or other applications. Argon2 has the following three variants (Argon2i is the default): Argon2d - suitable for applications with no threats from side-channel timing attacks (eg.

What are the three main uses of argon? ›

Industrial Uses:
  • Welding and Metal Fabrication. Argon is most commonly used in the welding and fabrication industry as an inert shielding agent. ...
  • Electrical Light Bulbs. Incandescent lightbulbs are typically filled with inert gases such as argon. ...
  • Food and Beverage. ...
  • Automotive. ...
  • Construction.

Is Argon2 Quantum safe? ›

Key-derivation functions (bcrypt, Scrypt, Argon2) are speculated as quantum-safe (only slightly affected by quantum computing).

Is Argon2 reversible? ›

Argon2 isn't just your run-of-the-mill hashing algorithm; it's a fortress designed to protect your passwords with unparalleled strength. Unlike encryption, which can be reversed, hashing irreversibly transforms passwords into unique, scrambled strings of characters.

Does Argon2 use salt? ›

All inputs password, salt, tag, associated data (a little more) are input to Argon2. If you put an empty string to salt, it will be the same function for all passwords.

Is Argon2 fast? ›

Argon2 is intentionally slow: slow-hashing functions are good for storing passwords, because it is time/resource consuming to crack them. In the case of Argon2, the hashing consumes memory, too.

What is the difference between Argon2 and MD5? ›

Argon2 is a modern password hashing algorithm that won the Password Hashing Competition in 2015. Compared to the traditional hashing algorithms such as MD5 or SHA1 before, argon2 offers a significant advantage as it was specifically designed to be resistant against brute-force as well as side-channel attacks.

What is the most secure hash function? ›

What's the Most Secure Hashing Algorithm? SHA-256. SHA-256 (secure hash algorithm) is an algorithm that takes an input of any length and uses it to create a 256-bit fixed-length hash value.

What are the benefits of argon? ›

Why Is Argon Gas Used in Windows? Argon gas does not conduct heat as well as air, so it's an excellent insulator. Gas filled windows also prevent a buildup of frost at the bottom of the window during cold weather (3).

What are the benefits of having Nord VPN? ›

Encrypted internet traffic, greater online privacy, and access to more content are the main advantages of a VPN.

What is the function of the argon? ›

Argon is a colourless, odourless gas that is totally inert to other substances. Argon is often used when an inert atmosphere is needed. It is used in this way for the production of titanium and other reactive elements.

What are the benefits of silicon carbide chips? ›

The Advantages of Silicon Carbide

Higher temperature capability: SiC can operate at much higher temperatures than silicon, often up to 400 degrees C and potentially up to 800 degrees C, allowing for more efficient electronic devices that can handle extreme conditions without significant performance degradation.

Top Articles
Importing configuration from main to backup switch.
Call Rejected Meaning: Understanding the Implications
Netronline Taxes
Chicago Neighborhoods: Lincoln Square & Ravenswood - Chicago Moms
Danatar Gym
Katmoie
Amtrust Bank Cd Rates
Craigslist Kennewick Pasco Richland
Dr Lisa Jones Dvm Married
Call Follower Osrs
Produzione mondiale di vino
Ou Class Nav
Craigslist Pets Athens Ohio
Luna Lola: The Moon Wolf book by Park Kara
Dr Manish Patel Mooresville Nc
Der Megatrend Urbanisierung
Grayling Purnell Net Worth
Water Trends Inferno Pool Cleaner
VERHUURD: Barentszstraat 12 in 'S-Gravenhage 2518 XG: Woonhuis.
Phoebus uses last-second touchdown to stun Salem for Class 4 football title
Empire Visionworks The Crossings Clifton Park Photos
Reborn Rich Kissasian
Drug Test 35765N
Craigslist Alo
Smartfind Express Login Broward
Cosas Aesthetic Para Decorar Tu Cuarto Para Imprimir
5 Star Rated Nail Salons Near Me
Everything You Need to Know About Ñ in Spanish | FluentU Spanish Blog
La Qua Brothers Funeral Home
Ellafeet.official
Los Amigos Taquería Kalona Menu
Nsu Occupational Therapy Prerequisites
The Mad Merchant Wow
Edict Of Force Poe
Shih Tzu dogs for sale in Ireland
Streameast.xy2
Craigslist Pets Huntsville Alabama
Elizaveta Viktorovna Bout
Cranston Sewer Tax
Flags Half Staff Today Wisconsin
Ferguson Employee Pipeline
Andrew Lee Torres
Shipping Container Storage Containers 40'HCs - general for sale - by dealer - craigslist
Martha's Vineyard – Travel guide at Wikivoyage
Goats For Sale On Craigslist
What is a lifetime maximum benefit? | healthinsurance.org
855-539-4712
Union Supply Direct Wisconsin
Erica Mena Net Worth Forbes
Erica Mena Net Worth Forbes
F9 2385
Pauline Frommer's Paris 2007 (Pauline Frommer Guides) - SILO.PUB
Latest Posts
Article information

Author: Rev. Porsche Oberbrunner

Last Updated:

Views: 5723

Rating: 4.2 / 5 (53 voted)

Reviews: 84% of readers found this page helpful

Author information

Name: Rev. Porsche Oberbrunner

Birthday: 1994-06-25

Address: Suite 153 582 Lubowitz Walks, Port Alfredoborough, IN 72879-2838

Phone: +128413562823324

Job: IT Strategist

Hobby: Video gaming, Basketball, Web surfing, Book restoration, Jogging, Shooting, Fishing

Introduction: My name is Rev. Porsche Oberbrunner, I am a zany, graceful, talented, witty, determined, shiny, enchanting person who loves writing and wants to share my knowledge and understanding with you.