__call()
__callstatic()
__construct()
_init()
forge()
instance()
calculate_mac()
decode()
encode()
hkdfBlake2b()
legacy_decode()
memzero()
raw_keyed_hash()
safe_b64decode()
safe_b64encode()
secure_compare()
split_keys()
split_message()
validate_hmac()
verify_mac()
$_instances
$config
$crypter
$defaults
$hasher
Sodium encryption/decryption code based on HaLite from ParagonIE
Copyright (c) 2016 - 2018 Paragon Initiative Enterprises. Copyright (c) 2014 Steve "Sc00bz" Thomas (steve at tobtu dot com)
__call(mixed $method, array $args) : mixed
mixed
arrayThe arguments will passed to $method.
\ErrorException | 
|---|
mixedreturn value of $method.__callstatic(mixed $method, array $args) : mixed
mixed
arrayThe arguments will passed to $method.
mixedreturn value of $method.__construct(array $config)
array
_init()
forge(string $name, array $config) : \Crypt
create a new named instance
stringinstance name
arrayoptional runtime configuration
\Cryptinstance(string $name) : mixed
stringinstance name
mixedCrypt if the instance exists, false if notcalculate_mac(string $message, $auth_key) : string
This is used internally.
string
stringdecode(string $value, string | bool $key, void $keylength) : string
| access | public | 
|---|
stringvalue to decrypt
stringbooloptional custom key to be used for this encryption
voidno longer used
stringencrypted valueencode(string $value, string | bool $key, void $keylength) : string
stringvalue to encrypt
stringbooloptional custom key to be used for this encryption
voidno longer used
stringencrypted valuehkdfBlake2b(string $ikm, int $length, string $info, string $salt) : string
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 crypto_generichash() key parameter. This is probably okay.
stringInitial Keying Material
intHow many bytes?
stringWhat sort of key are we deriving?
string
stringlegacy_decode(string $value, string | bool $key, int | bool $keylength) : string
| access | public | 
|---|
stringvalue to decrypt
stringbooloptional custom key to be used for this encryption
intbooloptional key length
stringencrypted valuememzero(string | null $var) : void
You need the native library for that.
stringnull
raw_keyed_hash(string $input, string $key, int $length) : string
Expects a key (binary string). Returns raw binary.
string
string
int
stringsafe_b64decode(string $value) : string
string
stringsafe_b64encode(string $value) : string
string
stringsecure_compare(string $a, string $b) : bool
string
string
boolsplit_keys(string $key, string $salt) : string[]
string
string
string[]validate_hmac($value)
verify_mac(string $mac, string $message, $auth_key) : bool
stringMessage Authentication Code
stringThe message to verify
bool$_instances : array
$config : array
$crypter : object
$defaults : array
$hasher : object