PHP 클래스 ElggCrypto, Elgg

파일 보기 프로젝트 열기: elgg/elgg 1 사용 예제들

공개 메소드들

메소드 설명
__construct ( SiteSecret $site_secret = null ) Constructor
areEqual ( string $str1, string $str2 ) : boolean Are two strings equal (compared in constant time)?
getHmac ( mixed $data, string $algo = 'sha256', string $key = '' ) : Elgg\Security\Hmac Get an HMAC token builder/validator object
getRandomBytes ( integer $length ) : string Generate a string of highly randomized bytes (over the full 8-bit range).
getRandomString ( integer $length, string | null $chars = null ) : string Generate a random string of specified length.

보호된 메소드들

메소드 설명
strlen ( string $binary_string ) : integer Count the number of bytes in a string

메소드 상세

__construct() 공개 메소드

Constructor
public __construct ( SiteSecret $site_secret = null )
$site_secret Elgg\Database\SiteSecret Secret service

areEqual() 공개 메소드

Are two strings equal (compared in constant time)?
저자: Anthony Ferrara ([email protected])
public areEqual ( string $str1, string $str2 ) : boolean
$str1 string First string to compare
$str2 string Second string to compare
리턴 boolean Based on password_verify in PasswordCompat

getHmac() 공개 메소드

Get an HMAC token builder/validator object
public getHmac ( mixed $data, string $algo = 'sha256', string $key = '' ) : Elgg\Security\Hmac
$data mixed HMAC data or serializable data
$algo string Hash algorithm
$key string Optional key (default uses site secret)
리턴 Elgg\Security\Hmac

getRandomBytes() 공개 메소드

Generate a string of highly randomized bytes (over the full 8-bit range).
public getRandomBytes ( integer $length ) : string
$length integer Number of bytes needed
리턴 string Random bytes

getRandomString() 공개 메소드

Uses supplied character list for generating the new string. If no character list provided - uses Base64 URL character set.
또한 보기: https://github.com/zendframework/zf2/blob/master/library/Zend/Math/Rand.php#L179
public getRandomString ( integer $length, string | null $chars = null ) : string
$length integer Desired length of the string
$chars string | null Characters to be chosen from randomly. If not given, the Base64 URL charset will be used.
리턴 string The random string

strlen() 보호된 메소드

We cannot simply use strlen() for this, because it might be overwritten by the mbstring extension. In this case, strlen() will count the number of *characters* based on the internal encoding. A sequence of bytes might be regarded as a single multibyte character. Use elgg_strlen() to count UTF-characters instead of bytes.
저자: Anthony Ferrara ([email protected])
protected strlen ( string $binary_string ) : integer
$binary_string string The input string
리턴 integer The number of bytes From PasswordCompat\binary\_strlen