Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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