Deon George
d3d7881e3b
All checks were successful
Create Docker Image / Test Application (x86_64) (push) Successful in 33s
Create Docker Image / Build Docker Image (x86_64) (push) Successful in 1m26s
Create Docker Image / Build Docker Image (arm64) (push) Successful in 3m36s
Create Docker Image / Final Docker Image Manifest (push) Successful in 11s
19 lines
462 B
PHP
19 lines
462 B
PHP
<?php
|
|
|
|
namespace App\Classes\LDAP\Attribute\Password;
|
|
|
|
final class SSHA256 extends Base
|
|
{
|
|
public const key = 'SSHA256';
|
|
protected const salt = 8;
|
|
|
|
public function compare(string $source,string $compare): bool
|
|
{
|
|
return $source === $this->encode($compare,$this->salted_salt($source));
|
|
}
|
|
|
|
public function encode(string $password,string $salt=NULL): string
|
|
{
|
|
return sprintf('{%s}%s',self::key,$this->salted_hash($password,'sha256',self::salt,$salt));
|
|
}
|
|
} |