Coherence
Search…
Argon2

PHC

spec
In order to understand hex and type parameters read HASH

Argon2

spec
Description: Password hashing winner of PHC.
Outputs: Variable
Uses: Highest resistance against GPU cracking attacks, safest against side-channel attacks.

How to ???

1
import requests
2
import json
3
import os,binascii
4
5
def sending(message):
6
url = 'http://127.0.0.1:6613/'
7
response=requests.post(url, data=message)
8
print response.content
9
return response.content
10
11
12
def argon(data_js):
13
req=json.loads(data_js)
14
print "Hash passwd \n " + json.dumps(req) +"\n"
15
data_js_n=sending(json.dumps(req))
16
answ=json.loads(data_js_n)
17
print "Recived Argon2 hash: \n" + (json.dumps(answ)) +"\n\n\n"
18
verify= '{ "version": 1 , "algorithm":"ARGON2" ,"family":"argon2i","plaintext": "Hello world!","hex":0,"pwd":"", "operation":"verify"}';
19
req=json.loads(verify)
20
req["pwd"]=answ["hash"]
21
print "Verify passwd \n " + json.dumps(req) +"\n"
22
data_js_n=sending(json.dumps(req))
23
answ_1=json.loads(data_js_n)
24
print "Recived Argon verification: \n" + (json.dumps(answ_1)) +"\n\n\n"
25
26
27
argon2_js='{ "version": 1 , "algorithm":"ARGON2" ,"family":"argon2i","plaintext": "Hello world!","t_cost":10,"m_cost":16,"parallelism":4,\
28
"salt":"ABABABABABABABABABABABABABABABAB","hashlen":32, "hex":0, "operation":"hash"}'
29
30
argon(argon2_js)
Copied!
In this example We generate hash and validate password with argon2i from string Hello world! with t_cost, m_cost, parallelism and salt parameters given.
In order to understand t_cost, m_cost, parallelism and salt parameters, please read spec.
  • On argon2_js["family"] can be one of {argon2i, argon2d, argon2id}
  • On argon2_js["operation"] can be {hash, verify}
  • ARGON2 only supports "type":"string"
Json to hash
1
{ "version": 1 , "algorithm":"ARGON2" ,"family":"argon2 flavor",
2
"plaintext": "your password","t_cost":INT,"m_cost":INT,"parallelism":INT,
3
"salt":"hex string","hashlen":INT, "hex": BOOL, "operation":"hash"}
Copied!
Json to verify
1
{ "version": 1 , "algorithm":"ARGON2" ,"family":"argon2 flavor",
2
"plaintext": "your password","hex":BOOL,"pwd":"Hex (hash arong2 string) ",
3
"operation":"verify"}
Copied!
In this tutorial We are protecting user's credentials with TLS and Argon2. It means the information is protected in motion, at rest, in use. End to end user credentials protection
Last modified 9mo ago
Copy link