public static function getDerivedKey($key, $salt, $iterations = 1000, $keyLen = 32)
{
if (function_exists("hash_pbkdf2")) {
$key = hash_pbkdf2('sha256', $key, $salt, $iterations, $keyLen, true);
} else {
// PHP v5.4 compatibility
$key = static::compat_pbkdf2('sha256', $key, $salt, $iterations, $keyLen, true);
}
return base64_encode($key);
}