Skip to content

Instantly share code, notes, and snippets.

@sarciszewski
Created January 16, 2015 01:13
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sarciszewski/a3b1cf19caab3f408bf8 to your computer and use it in GitHub Desktop.
Save sarciszewski/a3b1cf19caab3f408bf8 to your computer and use it in GitHub Desktop.
PBKDF2 Benchmarking Script
<?php
$it = [ 1000, 2000, 4000, 8000, 16000, 32000, 64000, 128000, 256000, 512000, 1024000, 2048000, 4096000 ];
foreach ($it as $i) {
$st = microtime(true);
$c = \hash_pbkdf2(
'sha256',
'example of a simple plaintext message goes here',
'something silly',
$i,
32,
true
);
$en = microtime(true);
$elapsed = number_format( $en - $st, 3);
echo "{$i}\t{$elapsed}\n";
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment