src/site/php/sodium fix.php

Classes

SodiumException

Functions

cfw_sodium_installed()

cfw_sodium_installed() : bool

Returns

bool —

cfw_sodium_fail()

cfw_sodium_fail(string  $why) : never

Raises what ext-sodium raises.

Parameters

string $why

The message.

Throws

\SodiumException

Returns

never —

cfw_sodium_str()

cfw_sodium_str(string  $fn, int  $at, string  $name, mixed  $v) : string

A string argument as the base64 the host reads, coerced the way an internal function coerces it.

Parameters

string $fn

The function name, for the message.

int $at

The argument's zero-based position.

string $name

The parameter name.

mixed $v

What the caller passed.

Returns

string —

cfw_sodium_int()

cfw_sodium_int(string  $fn, int  $at, string  $name, mixed  $v) : string

An int argument as the decimal string the host reads.

Parameters

string $fn

The function name, for the message.

int $at

The argument's zero-based position.

string $name

The parameter name.

mixed $v

What the caller passed.

Returns

string —

cfw_sodium_ref()

cfw_sodium_ref(string  $fn, int  $at, string  $name, mixed  $v) : string

A by-reference state argument; anything but a string is not a state.

Parameters

string $fn

The function name, for the message.

int $at

The argument's zero-based position.

string $name

The parameter name.

mixed $v

What the caller passed.

Returns

string —

cfw_sodium_dec()

cfw_sodium_dec(array  $v) : mixed

Reads one tagged value out of a reply.

Parameters

array $v

The tagged value.

Returns

mixed —

cfw_sodium_exchange()

cfw_sodium_exchange(string  $fn, array  $args) : array<string,mixed>

One call over the bridge.

Parameters

string $fn

The sodium function.

array $args

Its arguments, already base64 or decimal.

Returns

array —

The successful reply.

cfw_sodium_go()

cfw_sodium_go(string  $fn, array  $args) : mixed

Runs one wrapper's call: coerces each argument by its declared kind, crosses the bridge, and writes back any by-reference state.

Parameters

string $fn

The sodium function, from FUNCTION.

array $args

The wrapper's arguments, by reference where the function takes a state.

Returns

mixed —

cfw_sodium_string_ref()

cfw_sodium_string_ref(mixed  $v) : string

The message for a by-reference argument that is not a string.

Parameters

mixed $v

The argument.

Returns

string —

cfw_sodium_same_length()

cfw_sodium_same_length(string  $fn, string  $a, string  $b) : void

Two same-length arguments, or the refusal ext-sodium gives.

Parameters

string $fn

The function name.

string $a

The first string.

string $b

The second string.

Returns

void —

sodium_bin2hex()

sodium_bin2hex(mixed  $string) : mixed

Parameters

mixed $string

Returns

mixed —

cfw_sodium_arg()

cfw_sodium_arg(string  $fn, int  $at, string  $name, mixed  $v) : string

A string argument, coerced.

Parameters

string $fn

The function name.

int $at

The argument's zero-based position.

string $name

The parameter name.

mixed $v

The argument.

Returns

string —

sodium_hex2bin()

sodium_hex2bin(mixed  $string, mixed  $ignore = '') : mixed

Parameters

mixed $string
mixed $ignore

Returns

mixed —

cfw_sodium_variant()

cfw_sodium_variant(string  $fn, mixed  $id) : array{0: bool, 1: bool}

The base64 variant flags: padded, URL-safe.

Parameters

string $fn

The function name.

mixed $id

The caller's variant.

Returns

array{0: bool, 1: bool} —

sodium_bin2base64()

sodium_bin2base64(mixed  $string, mixed  $id) : mixed

Parameters

mixed $string
mixed $id

Returns

mixed —

sodium_base642bin()

sodium_base642bin(mixed  $string, mixed  $id, mixed  $ignore = '') : mixed

Parameters

mixed $string
mixed $id
mixed $ignore

Returns

mixed —

sodium_pad()

sodium_pad(mixed  $string, mixed  $block_size) : mixed

Parameters

mixed $string
mixed $block_size

Returns

mixed —

sodium_unpad()

sodium_unpad(mixed  $string, mixed  $block_size) : mixed

Parameters

mixed $string
mixed $block_size

Returns

mixed —

sodium_memzero()

sodium_memzero(mixed  $string) : mixed

Parameters

mixed $string

Returns

mixed —

sodium_memcmp()

sodium_memcmp(mixed  $string1, mixed  $string2) : mixed

Parameters

mixed $string1
mixed $string2

Returns

mixed —

sodium_compare()

sodium_compare(mixed  $string1, mixed  $string2) : mixed

Parameters

mixed $string1
mixed $string2

Returns

mixed —

sodium_increment()

sodium_increment(mixed  $string) : mixed

Parameters

mixed $string

Returns

mixed —

sodium_add()

sodium_add(mixed  $string1, mixed  $string2) : mixed

Parameters

mixed $string1
mixed $string2

Returns

mixed —