Skip to content

Instantly share code, notes, and snippets.

@lvh
Created August 4, 2018 16:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lvh/9f551c92e3b3347424a0c8dc61c73c2b to your computer and use it in GitHub Desktop.
Save lvh/9f551c92e3b3347424a0c8dc61c73c2b to your computer and use it in GitHub Desktop.
How fast is bcrypt_pbkdf anyway?
The original difficulty parameter for bcrypt is the log2 number of times to rekey the cipher. bhash fixes this number at 64, and instead relies on the PBKDF2 rounds parameter to control difficulty.
Default PBKDF2 rounds: 0x10 == 16
=> 20-30 ms for 1 key derivation
-a 100: ~150ms
or about 150ms for -a 100
user@personal ~ $ time ssh-keygen -o -f test-key -P "" && rm test-key 11:01:03
Generating public/private rsa key pair.
Your identification has been saved in test-key.
Your public key has been saved in test-key.pub.
The key fingerprint is:
SHA256:RuKjWtfiGX+O1U31srgL1A91a+IqSdJDSyjDooqd6eE user@personal
The key's randomart image is:
+---[RSA 2048]----+
| |
| |
| . . o . o|
| . = + o . . oo|
| . . = S o o.oo.|
| . . = * ..*oo |
|o..oo + + = o.+ |
|o.++ o = =.... |
| .E o ooo.o. |
+----[SHA256]-----+
ssh-keygen -o -f test-key -P "" 0.16s user 0.00s system 99% cpu 0.166 total
user@personal ~ $ time ssh-keygen -o -f test-key -P "iddqd" && rm test-key 11:01:04
Generating public/private rsa key pair.
Your identification has been saved in test-key.
Your public key has been saved in test-key.pub.
The key fingerprint is:
SHA256:7Z0asvZWbwq/DOOuyY/j2fOn21n7QoOthUYxCfN/KTg user@personal
The key's randomart image is:
+---[RSA 2048]----+
| o. . |
| o+ |
| .o |
| . o. .|
| S .E =...|
| . .*.*. |
| . *oo= ..|
| .oOoO..=o.|
| oOBBoOBooo|
+----[SHA256]-----+
ssh-keygen -o -f test-key -P "iddqd" 0.25s user 0.00s system 97% cpu 0.257 total
user@personal ~ $ time ssh-keygen -o -f test-key -P "iddqd" -a 100 && rm test-key 11:01:14
Generating public/private rsa key pair.
Your identification has been saved in test-key.
Your public key has been saved in test-key.pub.
The key fingerprint is:
SHA256:ngRngk5lPo8AfsryGJ++Nr0TSE8MVsQFbLH2AC3+x+0 user@personal
The key's randomart image is:
+---[RSA 2048]----+
| o*=++ |
| .+o=* |
| o.=O = o |
| .o*o+ O |
|o.o=..o.S |
| *..+ oo.. |
|. +. o .o |
| .o o E |
| .oo.o |
+----[SHA256]-----+
ssh-keygen -o -f test-key -P "iddqd" -a 100 0.88s user 0.00s system 99% cpu 0.883 total
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment