@@ -64,7 +64,10 @@ public static function sha512(string $data, bool $binary = false):string{
6464 }
6565
6666 /**
67- * Generates a secure random string of the given $length, using the characters (8-bit byte) in the given $keyspace.
67+ * Generates a secure random string of the given `$length`, using the characters (8-bit byte) in the given `$keyspace`.
68+ *
69+ * @see \random_int() - PHP <= 8.2
70+ * @see \Random\Randomizer - PHP >= 8.3
6871 *
6972 * @noinspection PhpFullyQualifiedNameUsageInspection
7073 * @SuppressWarnings(PHPMD.MissingImport)
@@ -88,7 +91,10 @@ public static function randomString(int $length, string $keyspace = self::ASCII_
8891 }
8992
9093 /**
91- * Creates a new cryptographically secure random encryption key (returned in hexadecimal format)
94+ * Creates a new cryptographically secure random encryption key for use with `encrypt()` and `decrypt()` (returned in hexadecimal format)
95+ *
96+ * @see \sodium_crypto_secretbox_keygen()
97+ * @see \sodium_crypto_secretbox())
9298 *
9399 * @throws \SodiumException
94100 */
@@ -97,7 +103,7 @@ public static function createEncryptionKey():string{
97103 }
98104
99105 /**
100- * Encrypts the given $data with $key, $format output [binary, base64, hex]
106+ * Encrypts the given ` $data` with ` $key`, formats the output according to `$format` [binary, base64, hex]
101107 *
102108 * @see \sodium_crypto_secretbox()
103109 * @see \sodium_bin2base64()
@@ -125,7 +131,7 @@ public static function encrypt(string $data, string $keyHex, int $format = self:
125131 }
126132
127133 /**
128- * Decrypts the given $encrypted data with $key from $format input [binary, base64, hex]
134+ * Decrypts the given ` $encrypted` data with ` $key` from input formatted according to ` $format` [binary, base64, hex]
129135 *
130136 * @see \sodium_crypto_secretbox_open()
131137 * @see \sodium_base642bin()
0 commit comments