php-simple-jwt/src/Key/JWTDerivedKey.php

20 lines
363 B
PHP
Raw Normal View History

2021-02-11 12:22:51 +00:00
<?php
2023-04-09 00:40:21 +00:00
namespace NoccyLabs\SimpleJWT\Key;
2021-02-11 12:22:51 +00:00
2023-04-09 00:40:21 +00:00
class JWTDerivedKey implements KeyInterface
2021-02-11 12:22:51 +00:00
{
private $key;
public function __construct(string $password, string $salt, int $iter=100)
{
$this->key = hash_pbkdf2("sha256", $password, $salt, $iter, 0, true);
}
public function getBinaryKey(): string
{
return $this->key;
}
}