feat: LiteHashDRBG 생성시 상세 지정
This commit is contained in:
@@ -21,9 +21,19 @@ class LiteHashDRBG implements RNG
|
||||
|
||||
protected string $buffer;
|
||||
protected int $bufferIdx;
|
||||
public function __construct(protected string $seed, protected int $stateIdx = 0)
|
||||
public function __construct(protected string $seed, protected int $stateIdx = 0, int $bufferIdx = 0)
|
||||
{
|
||||
if($bufferIdx < 0){
|
||||
throw new \InvalidArgumentException("bufferIdx {$bufferIdx} < 0");
|
||||
}
|
||||
if($bufferIdx >= self::BUFFER_BYTE_SIZE){
|
||||
throw new \InvalidArgumentException("bufferIdx {$bufferIdx} >= ".self::BUFFER_BYTE_SIZE);
|
||||
}
|
||||
if($stateIdx < 0){
|
||||
throw new \InvalidArgumentException("stateIdx {$stateIdx} < 0");
|
||||
}
|
||||
$this->genNextBlock();
|
||||
$this->bufferIdx = $bufferIdx;
|
||||
}
|
||||
|
||||
protected function genNextBlock(): void
|
||||
|
||||
Reference in New Issue
Block a user