Skip to content

Commit 61598a5

Browse files
authored
Update README.md
1 parent 3742225 commit 61598a5

File tree

1 file changed

+41
-7
lines changed

1 file changed

+41
-7
lines changed

README.md

Lines changed: 41 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,47 @@
11
# Argon2 for Delphi
22

3-
Argon2 is a password hashing function. It was selected as the winner of Google's [Password Hashing Competition](https://password-hashing.net/) in 2015.
3+
[Argon2](https://en.wikipedia.org/wiki/Argon2) is a key derivation function. It is designed to take a password (and some salt), and generate a desired number of pseudo-random bytes. Like *scrypt*, it is also *memory hard*, meaning it is designed thwart implementations on ASICs and GPUs. It was selected as the winner of Google's [Password Hashing Competition](https://password-hashing.net/) in 2015.
44

5-
This code is licensed under public domain **Unlicense**. One of the virtues of this license is that if you don't like the license, you can change the license to whatever you want. This means that if you are too stupid to understand what *public domain* means, you get to pick any other license:
5+
Sample Usage
6+
----------------
7+
8+
To hash a pssword using default cost factors:
9+
10+
hash := TArgon2.HashPassword('correct battery horse staple'); //using default cost factors
11+
12+
- To hash a password specifying your own cost factors:
13+
14+
hash := TArgon2.HashPassword('correct battery horse staple', 1000, 128*1024, 1); //Iterations=1000, Memory=128MB, Parallelism=1
15+
16+
- To verify a password:
17+
18+
isPasswordValid := TArgon2.CheckPassword('correct battery horse stapler', expectedHash, {out}passwordRehashNeeded);
19+
20+
21+
By convention Argon2 outputs a password hash as string in the form:
22+
23+
$Argon2id$v=[version]$m=[memoryKB],t=[type],p=[parallelism]$[salt]$[hash]
24+
$argon2i$v=19$m=65536,t=2,p=4$c29tZXNhbHQ$VGhpcyB3YXMgb25seSBhbiBleGFtcGxlLCBpIGRvbid0IGFjdHVhbGx5IGhhdmUgYSB2YWxpZCBpbXBsZW1udA==
25+
26+
The parts of the string are:
27+
28+
| Value | Meaning | Notes |
29+
|-------|---------|-------|
30+
| argon2id | Hash algorithm | "argon2id", "argon2d", "argon2i" |
31+
| v=19 | Decimal coded version | Default is 0x13, which is 19 decimal |
32+
| m=65536 | Memory size in KiB | Valid range: 8*Parallelism .. 0x7fffffff, and must be a power of two |
33+
| p=4 | Parallelization Factor | 1-0x00ffffff |
34+
| salt | base64 encoded salt | 0-16 bytes decoded |
35+
| hash | base64 encoded hash | 64-bytes |
36+
37+
Because the four argon parameters are stored in the returned string, argon2 password hashes are backwards and forwards compatible with changing the factors. It also makes Argon2 extraordinarily convenient, in that a random salt is automatically generated and stored for you (you don't have to worry about storing it in a database or retrieving it).
38+
39+
40+
This code is licensed under public domain **Unlicense**.
41+
42+
-----------------
43+
44+
One of the virtues of the Unlicense license is that if you don't like the license, you can change the license to whatever you want. This means that if you don't like the license, you are free to pick any other license you prefer (or your company or country understands):
645

746
- unlicense license
847
- DWTFYW license
@@ -11,8 +50,3 @@ This code is licensed under public domain **Unlicense**. One of the virtues of t
1150
- LGPL
1251
- MIT
1352
- Copyleft
14-
15-
For those of you who are *still* to dumb to understand what *public domain* means, I can officially and legally tell you:
16-
17-
- you're a moron
18-
- this code is officially licensed under a hept-license (kinda like *dual* license; but seven): you can pick whichever what your corporate pea-brains understand.

0 commit comments

Comments
 (0)