PHP 클래스 ParagonIE\Halite\Util

Various useful utilities, used within Halite and available for general use This library makes heavy use of return-type declarations, which are a PHP 7 only feature. Read more about them here:
파일 보기 프로젝트 열기: paragonie/halite 1 사용 예제들

공개 메소드들

메소드 설명
hash ( string $input, integer $length = Sodium\CRYPTO_GENERICHASH_BYTES ) : string Wrapper around \Sodium\crypto_generichash()
hkdfBlake2b ( string $ikm, integer $length, string $info = '', string $salt = '' ) : string Use a derivative of HKDF to derive multiple keys from one.
keyed_hash ( string $input, string $key, integer $length = Sodium\CRYPTO_GENERICHASH_BYTES ) : string Wrapper around \Sodium\crypto_generichash()
raw_hash ( string $input, integer $length = Sodium\CRYPTO_GENERICHASH_BYTES ) : string Wrapper around \Sodium\crypto_generichash()
raw_keyed_hash ( string $input, string $key, integer $length = Sodium\CRYPTO_GENERICHASH_BYTES ) : string Wrapper around \Sodium\crypto_generichash()
safeStrcpy ( string $string ) : string PHP 7 uses interned strings. We don't want altering this one to alter the original string.
safeStrlen ( string $str ) : integer Safe string length
safeSubstr ( string $str, integer $start, integer $length = null ) : string Safe substring
xorStrings ( string $left, string $right ) : string Calculate A xor B, given two binary strings of the same length.

비공개 메소드들

메소드 설명
__construct ( ) Don't allow this to be instantiated.

메소드 상세

hash() 공개 정적인 메소드

Returns hexadecimal characters.
public static hash ( string $input, integer $length = Sodium\CRYPTO_GENERICHASH_BYTES ) : string
$input string
$length integer
리턴 string

hkdfBlake2b() 공개 정적인 메소드

http://tools.ietf.org/html/rfc5869 This is a variant from hash_hkdf() and instead uses BLAKE2b provided by libsodium. Important: instead of a true HKDF (from HMAC) construct, this uses the \Sodium\crypto_generichash() key parameter. This is *probably* okay.
public static hkdfBlake2b ( string $ikm, integer $length, string $info = '', string $salt = '' ) : string
$ikm string Initial Keying Material
$length integer How many bytes?
$info string What sort of key are we deriving?
$salt string
리턴 string

keyed_hash() 공개 정적인 메소드

Expects a key (binary string). Returns hexadecimal characters.
public static keyed_hash ( string $input, string $key, integer $length = Sodium\CRYPTO_GENERICHASH_BYTES ) : string
$input string
$key string
$length integer
리턴 string

raw_hash() 공개 정적인 메소드

Returns raw binary.
public static raw_hash ( string $input, integer $length = Sodium\CRYPTO_GENERICHASH_BYTES ) : string
$input string
$length integer
리턴 string

raw_keyed_hash() 공개 정적인 메소드

Expects a key (binary string). Returns raw binary.
public static raw_keyed_hash ( string $input, string $key, integer $length = Sodium\CRYPTO_GENERICHASH_BYTES ) : string
$input string
$key string
$length integer
리턴 string

safeStrcpy() 공개 정적인 메소드

PHP 7 uses interned strings. We don't want altering this one to alter the original string.
public static safeStrcpy ( string $string ) : string
$string string
리턴 string

safeStrlen() 공개 정적인 메소드

Safe string length
public static safeStrlen ( string $str ) : integer
$str string
리턴 integer

safeSubstr() 공개 정적인 메소드

Safe substring
public static safeSubstr ( string $str, integer $start, integer $length = null ) : string
$str string
$start integer
$length integer
리턴 string

xorStrings() 공개 정적인 메소드

Uses pack() and unpack() to avoid cache-timing leaks caused by chr().
public static xorStrings ( string $left, string $right ) : string
$left string
$right string
리턴 string