PeServer

Cryptography
in package

AbstractYes

暗号化周り

Table of Contents

Constants

DEFAULT_RANDOM_STRING  = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz'
文字列乱数 標準文字列
FILE_RANDOM_STRING  = '0123456789abcdefghijklmnopqrstuvwxyz'
文字列乱数 ファイルとして扱える文字列
SEPARATOR  = '@'
文字列への暗号化時のセパレータ
OPTION  = 0

Methods

decrypt()  : string
Cryptography::encrypt で暗号化されたデータの復元。
encrypt()  : string
文字列を暗号化。
generateHashBinary()  : Binary
ハッシュ化処理(バイナリ)。
generateHashString()  : string
ハッシュ化処理(文字列)。
generateRandomBinary()  : Binary
ランダムバイナリデータを生成。
generateRandomInteger()  : int
乱数取得。
generateRandomString()  : string
ランダム文字列を生成。
getHashAlgorithms()  : array<string|int, string>
ハッシュアルゴリズム一覧。
getPasswordAlgorithms()  : array<string|int, string>
`password_algos` ラッパー。
getPasswordInformation()  : array{algo: string, algoName: string, options: array}
`password_get_info` ラッパー。
hashPassword()  : string
`password_hash($password, PASSWORD_DEFAULT)`ラッパー。
needsRehashPassword()  : bool
`password_needs_rehash` ラッパー。
verifyPassword()  : bool
`password_verify(string $password, $hashPassword)` ラッパー。
generateHashCore()  : string
ハッシュ値生成。

Constants

DEFAULT_RANDOM_STRING

文字列乱数 標準文字列

public mixed DEFAULT_RANDOM_STRING = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz'

FILE_RANDOM_STRING

文字列乱数 ファイルとして扱える文字列

public mixed FILE_RANDOM_STRING = '0123456789abcdefghijklmnopqrstuvwxyz'

SEPARATOR

文字列への暗号化時のセパレータ

public mixed SEPARATOR = '@'

Methods

decrypt()

Cryptography::encrypt で暗号化されたデータの復元。

public static decrypt(string $encValue, string $password) : string
Parameters
$encValue : string

暗号化データ。

$password : string

パスワード。

Tags
throws
CryptoException

失敗

Return values
string

生文字列。

encrypt()

文字列を暗号化。

public static encrypt(non-empty-string $algorithm, string $rawValue, string $password) : string
Parameters
$algorithm : non-empty-string

暗号化方法。

$rawValue : string

生文字列。

$password : string

パスワード。

Tags
throws
CryptoException

失敗

Return values
string

暗号化された文字列。 アルゴリズム@IV@暗号化データ となる。

generateHashBinary()

ハッシュ化処理(バイナリ)。

public static generateHashBinary(non-empty-string $algorithm, Binary $binary[, array{seed?: ?int} $options = [] ]) : Binary

hash ラッパー。

Parameters
$algorithm : non-empty-string

アルゴリズム。

$binary : Binary

入力バイナリデータ。

$options : array{seed?: ?int} = []
Tags
throws
CryptoException
see
https://www.php.net/manual/function.hash.php
Return values
Binary

ハッシュバイナリ。

generateHashString()

ハッシュ化処理(文字列)。

public static generateHashString(non-empty-string $algorithm, Binary $binary[, array{seed?: ?int} $options = [] ]) : string

hash ラッパー。

Parameters
$algorithm : non-empty-string
$binary : Binary

入力バイナリデータ。

$options : array{seed?: ?int} = []
Tags
throws
CryptoException
see
https://www.php.net/manual/function.hash.php
Return values
string

文字列表現。

generateRandomString()

ランダム文字列を生成。

public static generateRandomString(int $length[, non-empty-string $characters = self::DEFAULT_RANDOM_STRING ]) : string
Parameters
$length : int

文字列長。

$characters : non-empty-string = self::DEFAULT_RANDOM_STRING

ランダム文字の元になる文字列。

Tags
phpstan-param

positive-int $length

throws
CryptoException

失敗

Return values
string

文字列。

getPasswordInformation()

`password_get_info` ラッパー。

public static getPasswordInformation(string $hashPassword) : array{algo: string, algoName: string, options: array}
Parameters
$hashPassword : string
Tags
see
https://www.php.net/manual/function.password-get-info.php
Return values
array{algo: string, algoName: string, options: array}

verifyPassword()

`password_verify(string $password, $hashPassword)` ラッパー。

public static verifyPassword(string $password, string $hashPassword) : bool
Parameters
$password : string

生パスワード。

$hashPassword : string

ハッシュ化パスワード。

Tags
see
https://www.php.net/manual/function.password-verify.php
Return values
bool

一致。

generateHashCore()

ハッシュ値生成。

private static generateHashCore(bool $isBinary, string $algorithm, Binary $binary[, array{seed?: ?int} $options = [] ]) : string
Parameters
$isBinary : bool
$algorithm : string
$binary : Binary
$options : array{seed?: ?int} = []
Return values
string

        
On this page

Search results