Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
Signed-off-by: Nguyen Van Nguyen <[email protected]>
  • Loading branch information
nguyennv committed Dec 15, 2023
1 parent 1a2b4c4 commit e4369cc
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
6 changes: 3 additions & 3 deletions src/Common/S2K.php
Original file line number Diff line number Diff line change
Expand Up @@ -115,9 +115,9 @@ public function getLength(): int
* Parsing function for a string-to-key specifier
*
* @param string $bytes - Payload of string-to-key specifier
* @return static
* @return self
*/
public static function fromBytes(string $bytes): static
public static function fromBytes(string $bytes): self
{
$salt = '';
$itCount = self::DEFAULT_IT_COUNT;
Expand All @@ -133,7 +133,7 @@ public static function fromBytes(string $bytes): static
$itCount = ord($bytes[10]);
break;
}
return new static($salt, $type, $hash, $itCount);
return new self($salt, $type, $hash, $itCount);
}

/**
Expand Down
4 changes: 2 additions & 2 deletions src/Cryptor/Aead/GCM.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ final class GCM implements AeadCipher
* @return self
*/
public function __construct(
private readonly string $key,
string $key,
SymmetricAlgorithm $symmetric = SymmetricAlgorithm::Aes128
)
{
Expand Down Expand Up @@ -79,7 +79,7 @@ public function getNonce(string $iv, string $chunkIndex): string
{
$nonce = $iv;
for ($i = 0; $i < strlen($chunkIndex); $i++) {
$nonce[4 + $i] = $nonce[4 + $i] ^ $chunkIndex[i];
$nonce[4 + $i] = $nonce[4 + $i] ^ $chunkIndex[$i];
}
return $nonce;
}
Expand Down
4 changes: 2 additions & 2 deletions src/Cryptor/Aead/OCB.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ final class OCB implements AeadCipher
* @return self
*/
public function __construct(
private readonly string $key,
string $key,
SymmetricAlgorithm $symmetric = SymmetricAlgorithm::Aes128
)
{
Expand Down Expand Up @@ -133,7 +133,7 @@ public function getNonce(string $iv, string $chunkIndex): string
* Encrypt/decrypt data.
*
* @param BlockCipher $cipher - Encryption/decryption block cipher function
* @param string $ciphertext - The cleartext or ciphertext (without tag) input
* @param string $text - The cleartext or ciphertext (without tag) input
* @param string $nonce - The nonce (15 bytes)
* @param string $adata - Associated data to sign
* @return string The ciphertext or plaintext output, with tag appended in both cases.
Expand Down

0 comments on commit e4369cc

Please sign in to comment.