2022-06-15 08:11:48 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
|
|
namespace Appwrite\Utopia\Response\Model;
|
|
|
|
|
|
|
|
|
|
use Appwrite\Utopia\Response;
|
|
|
|
|
use Appwrite\Utopia\Response\Model;
|
|
|
|
|
|
|
|
|
|
class AlgoArgon2 extends Model
|
|
|
|
|
{
|
|
|
|
|
public function __construct()
|
|
|
|
|
{
|
2022-06-17 09:25:28 +00:00
|
|
|
// No options if imported. If hashed by Appwrite, following configuration is available:
|
2022-06-15 08:11:48 +00:00
|
|
|
$this
|
2022-10-10 23:27:03 +00:00
|
|
|
->addRule('type', [
|
|
|
|
|
'type' => self::TYPE_STRING,
|
|
|
|
|
'description' => 'Algo type.',
|
|
|
|
|
'default' => 'argon2',
|
|
|
|
|
'example' => 'argon2',
|
|
|
|
|
])
|
2022-06-16 09:21:35 +00:00
|
|
|
->addRule('memoryCost', [
|
2022-06-15 08:11:48 +00:00
|
|
|
'type' => self::TYPE_INTEGER,
|
2022-08-12 15:55:47 +00:00
|
|
|
'description' => 'Memory used to compute hash.',
|
2022-06-15 08:11:48 +00:00
|
|
|
'default' => '',
|
|
|
|
|
'example' => 65536,
|
|
|
|
|
])
|
2022-06-16 09:21:35 +00:00
|
|
|
->addRule('timeCost', [
|
2022-06-15 08:11:48 +00:00
|
|
|
'type' => self::TYPE_INTEGER,
|
2022-08-12 15:55:33 +00:00
|
|
|
'description' => 'Amount of time consumed to compute hash',
|
2022-06-15 08:11:48 +00:00
|
|
|
'default' => '',
|
|
|
|
|
'example' => 4,
|
|
|
|
|
])
|
|
|
|
|
->addRule('threads', [
|
|
|
|
|
'type' => self::TYPE_INTEGER,
|
2022-08-12 15:54:31 +00:00
|
|
|
'description' => 'Number of threads used to compute hash.',
|
2022-06-15 08:11:48 +00:00
|
|
|
'default' => '',
|
|
|
|
|
'example' => 3,
|
|
|
|
|
])
|
|
|
|
|
;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Get Name
|
|
|
|
|
*
|
|
|
|
|
* @return string
|
|
|
|
|
*/
|
|
|
|
|
public function getName(): string
|
|
|
|
|
{
|
|
|
|
|
return 'AlgoArgon2';
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Get Type
|
|
|
|
|
*
|
|
|
|
|
* @return string
|
|
|
|
|
*/
|
|
|
|
|
public function getType(): string
|
|
|
|
|
{
|
|
|
|
|
return Response::MODEL_ALGO_ARGON2;
|
|
|
|
|
}
|
|
|
|
|
}
|