You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: generated/misc.php
+4-1Lines changed: 4 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -110,13 +110,16 @@ function sapi_windows_cp_set(int $cp): void
110
110
111
111
112
112
/**
113
-
* If enable is omitted, the function return TRUE if the stream stream has VT100 control codes enabled, FALSE otherwise.
113
+
* If enable is omitted, the function returns TRUE if the stream stream has VT100 control codes enabled, FALSE otherwise.
114
114
*
115
115
* If enable is specified, the function will try to enable or disable the VT100 features of the stream stream.
116
116
* If the feature has been successfully enabled (or disabled), .
117
117
*
118
118
* At startup, PHP tries to enable the VT100 feature of the STDOUT/STDERR streams. By the way, if those streams are redirected to a file, the VT100 features may not be enabled.
119
119
*
120
+
* If VT100 support is enabled, it is possible to use control sequences as they are known from the VT100 terminal.
121
+
* They allow the modification of the terminal's output. On Windows these sequences are called Console Virtual Terminal Sequences.
122
+
*
120
123
* @param resource $stream The stream on which the function will operate.
121
124
* @param bool $enable If specified, the VT100 feature will be enabled (if TRUE) or disabled (if FALSE).
Copy file name to clipboardExpand all lines: generated/sodium.php
+28-7Lines changed: 28 additions & 7 deletions
Original file line number
Diff line number
Diff line change
@@ -5,20 +5,41 @@
5
5
useSafe\Exceptions\SodiumException;
6
6
7
7
/**
8
+
* Uses a CPU- and memory-hard hash algorithm along with a randomly-generated salt, and memory and CPU limits to generate an ASCII-encoded hash suitable for password storage.
8
9
*
10
+
* @param string $password string; The password to generate a hash for.
11
+
* @param int $opslimit Represents a maximum amount of computations to perform. Raising this number will make the function require more CPU cycles to compute a key. There are constants available to set the operations limit to appropriate values depending on intended use, in order of strength: SODIUM_CRYPTO_PWHASH_OPSLIMIT_INTERACTIVE, SODIUM_CRYPTO_PWHASH_OPSLIMIT_MODERATE and SODIUM_CRYPTO_PWHASH_OPSLIMIT_SENSITIVE.
12
+
* @param int $memlimit The maximum amount of RAM that the function will use, in bytes. There are constants to help you choose an appropriate value, in order of size: SODIUM_CRYPTO_PWHASH_MEMLIMIT_INTERACTIVE, SODIUM_CRYPTO_PWHASH_MEMLIMIT_MODERATE, and SODIUM_CRYPTO_PWHASH_MEMLIMIT_SENSITIVE. Typically these should be paired with the matching opslimit values.
13
+
* @return string Returns the hashed password, .
14
+
*
15
+
* In order to produce the same password hash from the same password, the same values for opslimit and memlimit must be used. These are embedded within the generated hash, so
16
+
* everything that's needed to verify the hash is included. This allows
17
+
* the sodium_crypto_pwhash_str_verify function to verify the hash without
18
+
* needing separate storage for the other parameters.
* This function provides low-level access to libsodium's crypto_pwhash key derivation function. Unless you have specific reason to use this function, you should use sodium_crypto_pwhash_str or password_hash functions instead.
9
35
*
10
36
* @param int $length integer; The length of the password hash to generate, in bytes.
11
37
* @param string $password string; The password to generate a hash for.
12
38
* @param string $salt string A salt to add to the password before hashing. The salt should be unpredictable, ideally generated from a good random mumber source such as random_bytes, and have a length of at least SODIUM_CRYPTO_PWHASH_SALTBYTES bytes.
13
39
* @param int $opslimit Represents a maximum amount of computations to perform. Raising this number will make the function require more CPU cycles to compute a key. There are some constants available to set the operations limit to appropriate values depending on intended use, in order of strength: SODIUM_CRYPTO_PWHASH_OPSLIMIT_INTERACTIVE, SODIUM_CRYPTO_PWHASH_OPSLIMIT_MODERATE and SODIUM_CRYPTO_PWHASH_OPSLIMIT_SENSITIVE.
14
40
* @param int $memlimit The maximum amount of RAM that the function will use, in bytes. There are constants to help you choose an appropriate value, in order of size: SODIUM_CRYPTO_PWHASH_MEMLIMIT_INTERACTIVE, SODIUM_CRYPTO_PWHASH_MEMLIMIT_MODERATE, and SODIUM_CRYPTO_PWHASH_MEMLIMIT_SENSITIVE. Typically these should be paired with the matching opslimit values.
15
-
* @param int $alg integer A number indicating the hash algorithm to use. By default SODIUM_CRYPTO_PWHASH_ALG_DEFAULT (the currently recommended algorithm, which can change from one version of libsodium to another), or explicitly using SODIUM_CRYPTO_PWHASH_ALG_ARGON2I13, representing the Argon2id algorithm version 1.3.
16
-
* @return string Returns the hashed password, .
17
-
*
18
-
* The used algorithm, opslimit, memlimit and salt are embedded within the hash, so
19
-
* all information needed to verify the hash is included. This allows
20
-
* the password_verify function to verify the hash without
21
-
* needing separate storage for the salt or algorithm information.
41
+
* @param int $alg integer A number indicating the hash algorithm to use. By default SODIUM_CRYPTO_PWHASH_ALG_DEFAULT (the currently recommended algorithm, which can change from one version of libsodium to another), or explicitly using SODIUM_CRYPTO_PWHASH_ALG_ARGON2ID13, representing the Argon2id algorithm version 1.3.
42
+
* @return string Returns the derived key, . The return value is a binary string of the hash, not an ASCII-encoded representation, and does not contain additional information about the parameters used to create the hash, so you will need to keep that information if you are ever going to verify the password in future. Use sodium_crypto_pwhash_str to avoid needing to do all that.
0 commit comments