author | ymh <ymh.work@gmail.com> |
Fri, 05 Sep 2025 18:40:08 +0200 | |
changeset 21 | 48c4eec2b7e6 |
parent 18 | be944660c56a |
child 22 | 8c2e4d02f4ef |
permissions | -rw-r--r-- |
18 | 1 |
<?php |
2 |
||
3 |
if (!defined('SODIUM_CRYPTO_CORE_RISTRETTO255_BYTES')) { |
|
4 |
define( |
|
5 |
'SODIUM_CRYPTO_CORE_RISTRETTO255_BYTES', |
|
6 |
ParagonIE_Sodium_Compat::CRYPTO_CORE_RISTRETTO255_BYTES |
|
7 |
); |
|
8 |
define('SODIUM_COMPAT_POLYFILLED_RISTRETTO255', true); |
|
9 |
} |
|
10 |
if (!defined('SODIUM_CRYPTO_CORE_RISTRETTO255_HASHBYTES')) { |
|
11 |
define( |
|
12 |
'SODIUM_CRYPTO_CORE_RISTRETTO255_HASHBYTES', |
|
13 |
ParagonIE_Sodium_Compat::CRYPTO_CORE_RISTRETTO255_HASHBYTES |
|
14 |
); |
|
15 |
} |
|
16 |
if (!defined('SODIUM_CRYPTO_CORE_RISTRETTO255_SCALARBYTES')) { |
|
17 |
define( |
|
18 |
'SODIUM_CRYPTO_CORE_RISTRETTO255_SCALARBYTES', |
|
19 |
ParagonIE_Sodium_Compat::CRYPTO_CORE_RISTRETTO255_SCALARBYTES |
|
20 |
); |
|
21 |
} |
|
22 |
if (!defined('SODIUM_CRYPTO_CORE_RISTRETTO255_NONREDUCEDSCALARBYTES')) { |
|
23 |
define( |
|
24 |
'SODIUM_CRYPTO_CORE_RISTRETTO255_NONREDUCEDSCALARBYTES', |
|
25 |
ParagonIE_Sodium_Compat::CRYPTO_CORE_RISTRETTO255_NONREDUCEDSCALARBYTES |
|
26 |
); |
|
27 |
} |
|
28 |
if (!defined('SODIUM_CRYPTO_SCALARMULT_RISTRETTO255_SCALARBYTES')) { |
|
29 |
define( |
|
30 |
'SODIUM_CRYPTO_SCALARMULT_RISTRETTO255_SCALARBYTES', |
|
31 |
ParagonIE_Sodium_Compat::CRYPTO_SCALARMULT_RISTRETTO255_SCALARBYTES |
|
32 |
); |
|
33 |
} |
|
34 |
if (!defined('SODIUM_CRYPTO_SCALARMULT_RISTRETTO255_BYTES')) { |
|
35 |
define( |
|
36 |
'SODIUM_CRYPTO_SCALARMULT_RISTRETTO255_BYTES', |
|
37 |
ParagonIE_Sodium_Compat::CRYPTO_SCALARMULT_RISTRETTO255_BYTES |
|
38 |
); |
|
39 |
} |
|
40 |
||
41 |
if (!is_callable('sodium_crypto_core_ristretto255_add')) { |
|
42 |
/** |
|
43 |
* @see ParagonIE_Sodium_Compat::ristretto255_add() |
|
44 |
* |
|
45 |
* @param string $p |
|
46 |
* @param string $q |
|
47 |
* @return string |
|
48 |
* @throws SodiumException |
|
49 |
*/ |
|
50 |
function sodium_crypto_core_ristretto255_add($p, $q) |
|
51 |
{ |
|
52 |
return ParagonIE_Sodium_Compat::ristretto255_add($p, $q, true); |
|
53 |
} |
|
54 |
} |
|
55 |
if (!is_callable('sodium_crypto_core_ristretto255_from_hash')) { |
|
56 |
/** |
|
57 |
* @see ParagonIE_Sodium_Compat::ristretto255_from_hash() |
|
58 |
* |
|
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
18
diff
changeset
|
59 |
* @param string $s |
18 | 60 |
* @return string |
61 |
* @throws SodiumException |
|
62 |
*/ |
|
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
18
diff
changeset
|
63 |
function sodium_crypto_core_ristretto255_from_hash($s) |
18 | 64 |
{ |
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
18
diff
changeset
|
65 |
return ParagonIE_Sodium_Compat::ristretto255_from_hash($s, true); |
18 | 66 |
} |
67 |
} |
|
68 |
if (!is_callable('sodium_crypto_core_ristretto255_is_valid_point')) { |
|
69 |
/** |
|
70 |
* @see ParagonIE_Sodium_Compat::ristretto255_is_valid_point() |
|
71 |
* |
|
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
18
diff
changeset
|
72 |
* @param string $s |
18 | 73 |
* @return bool |
74 |
* @throws SodiumException |
|
75 |
*/ |
|
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
18
diff
changeset
|
76 |
function sodium_crypto_core_ristretto255_is_valid_point($s) |
18 | 77 |
{ |
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
18
diff
changeset
|
78 |
return ParagonIE_Sodium_Compat::ristretto255_is_valid_point($s, true); |
18 | 79 |
} |
80 |
} |
|
81 |
if (!is_callable('sodium_crypto_core_ristretto255_random')) { |
|
82 |
/** |
|
83 |
* @see ParagonIE_Sodium_Compat::ristretto255_random() |
|
84 |
* |
|
85 |
* @return string |
|
86 |
* @throws SodiumException |
|
87 |
*/ |
|
88 |
function sodium_crypto_core_ristretto255_random() |
|
89 |
{ |
|
90 |
return ParagonIE_Sodium_Compat::ristretto255_random(true); |
|
91 |
} |
|
92 |
} |
|
93 |
if (!is_callable('sodium_crypto_core_ristretto255_scalar_add')) { |
|
94 |
/** |
|
95 |
* @see ParagonIE_Sodium_Compat::ristretto255_scalar_add() |
|
96 |
* |
|
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
18
diff
changeset
|
97 |
* @param string $x |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
18
diff
changeset
|
98 |
* @param string $y |
18 | 99 |
* @return string |
100 |
* @throws SodiumException |
|
101 |
*/ |
|
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
18
diff
changeset
|
102 |
function sodium_crypto_core_ristretto255_scalar_add($x, $y) |
18 | 103 |
{ |
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
18
diff
changeset
|
104 |
return ParagonIE_Sodium_Compat::ristretto255_scalar_add($x, $y, true); |
18 | 105 |
} |
106 |
} |
|
107 |
if (!is_callable('sodium_crypto_core_ristretto255_scalar_complement')) { |
|
108 |
/** |
|
109 |
* @see ParagonIE_Sodium_Compat::ristretto255_scalar_complement() |
|
110 |
* |
|
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
18
diff
changeset
|
111 |
* @param string $s |
18 | 112 |
* @return string |
113 |
* @throws SodiumException |
|
114 |
*/ |
|
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
18
diff
changeset
|
115 |
function sodium_crypto_core_ristretto255_scalar_complement($s) |
18 | 116 |
{ |
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
18
diff
changeset
|
117 |
return ParagonIE_Sodium_Compat::ristretto255_scalar_complement($s, true); |
18 | 118 |
} |
119 |
} |
|
120 |
if (!is_callable('sodium_crypto_core_ristretto255_scalar_invert')) { |
|
121 |
/** |
|
122 |
* @see ParagonIE_Sodium_Compat::ristretto255_scalar_invert() |
|
123 |
* |
|
124 |
* @param string $p |
|
125 |
* @return string |
|
126 |
* @throws SodiumException |
|
127 |
*/ |
|
128 |
function sodium_crypto_core_ristretto255_scalar_invert($p) |
|
129 |
{ |
|
130 |
return ParagonIE_Sodium_Compat::ristretto255_scalar_invert($p, true); |
|
131 |
} |
|
132 |
} |
|
133 |
if (!is_callable('sodium_crypto_core_ristretto255_scalar_mul')) { |
|
134 |
/** |
|
135 |
* @see ParagonIE_Sodium_Compat::ristretto255_scalar_mul() |
|
136 |
* |
|
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
18
diff
changeset
|
137 |
* @param string $x |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
18
diff
changeset
|
138 |
* @param string $y |
18 | 139 |
* @return string |
140 |
* @throws SodiumException |
|
141 |
*/ |
|
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
18
diff
changeset
|
142 |
function sodium_crypto_core_ristretto255_scalar_mul($x, $y) |
18 | 143 |
{ |
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
18
diff
changeset
|
144 |
return ParagonIE_Sodium_Compat::ristretto255_scalar_mul($x, $y, true); |
18 | 145 |
} |
146 |
} |
|
147 |
if (!is_callable('sodium_crypto_core_ristretto255_scalar_negate')) { |
|
148 |
/** |
|
149 |
* @see ParagonIE_Sodium_Compat::ristretto255_scalar_negate() |
|
150 |
* |
|
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
18
diff
changeset
|
151 |
* @param string $s |
18 | 152 |
* @return string |
153 |
* @throws SodiumException |
|
154 |
*/ |
|
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
18
diff
changeset
|
155 |
function sodium_crypto_core_ristretto255_scalar_negate($s) |
18 | 156 |
{ |
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
18
diff
changeset
|
157 |
return ParagonIE_Sodium_Compat::ristretto255_scalar_negate($s, true); |
18 | 158 |
} |
159 |
} |
|
160 |
if (!is_callable('sodium_crypto_core_ristretto255_scalar_random')) { |
|
161 |
/** |
|
162 |
* @see ParagonIE_Sodium_Compat::ristretto255_scalar_random() |
|
163 |
* |
|
164 |
* @return string |
|
165 |
* @throws SodiumException |
|
166 |
*/ |
|
167 |
function sodium_crypto_core_ristretto255_scalar_random() |
|
168 |
{ |
|
169 |
return ParagonIE_Sodium_Compat::ristretto255_scalar_random(true); |
|
170 |
} |
|
171 |
} |
|
172 |
if (!is_callable('sodium_crypto_core_ristretto255_scalar_reduce')) { |
|
173 |
/** |
|
174 |
* @see ParagonIE_Sodium_Compat::ristretto255_scalar_reduce() |
|
175 |
* |
|
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
18
diff
changeset
|
176 |
* @param string $s |
18 | 177 |
* @return string |
178 |
* @throws SodiumException |
|
179 |
*/ |
|
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
18
diff
changeset
|
180 |
function sodium_crypto_core_ristretto255_scalar_reduce($s) |
18 | 181 |
{ |
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
18
diff
changeset
|
182 |
return ParagonIE_Sodium_Compat::ristretto255_scalar_reduce($s, true); |
18 | 183 |
} |
184 |
} |
|
185 |
if (!is_callable('sodium_crypto_core_ristretto255_scalar_sub')) { |
|
186 |
/** |
|
187 |
* @see ParagonIE_Sodium_Compat::ristretto255_scalar_sub() |
|
188 |
* |
|
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
18
diff
changeset
|
189 |
* @param string $x |
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
18
diff
changeset
|
190 |
* @param string $y |
18 | 191 |
* @return string |
192 |
* @throws SodiumException |
|
193 |
*/ |
|
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
18
diff
changeset
|
194 |
function sodium_crypto_core_ristretto255_scalar_sub($x, $y) |
18 | 195 |
{ |
21
48c4eec2b7e6
Add CLAUDE.md documentation and sync WordPress core files
ymh <ymh.work@gmail.com>
parents:
18
diff
changeset
|
196 |
return ParagonIE_Sodium_Compat::ristretto255_scalar_sub($x, $y, true); |
18 | 197 |
} |
198 |
} |
|
199 |
if (!is_callable('sodium_crypto_core_ristretto255_sub')) { |
|
200 |
/** |
|
201 |
* @see ParagonIE_Sodium_Compat::ristretto255_sub() |
|
202 |
* |
|
203 |
* @param string $p |
|
204 |
* @param string $q |
|
205 |
* @return string |
|
206 |
* @throws SodiumException |
|
207 |
*/ |
|
208 |
function sodium_crypto_core_ristretto255_sub($p, $q) |
|
209 |
{ |
|
210 |
return ParagonIE_Sodium_Compat::ristretto255_sub($p, $q, true); |
|
211 |
} |
|
212 |
} |
|
213 |
if (!is_callable('sodium_crypto_scalarmult_ristretto255')) { |
|
214 |
/** |
|
215 |
* @see ParagonIE_Sodium_Compat::crypto_scalarmult_ristretto255() |
|
216 |
* @param string $n |
|
217 |
* @param string $p |
|
218 |
* @return string |
|
219 |
* @throws SodiumException |
|
220 |
* @throws TypeError |
|
221 |
*/ |
|
222 |
function sodium_crypto_scalarmult_ristretto255($n, $p) |
|
223 |
{ |
|
224 |
return ParagonIE_Sodium_Compat::scalarmult_ristretto255($n, $p, true); |
|
225 |
} |
|
226 |
} |
|
227 |
if (!is_callable('sodium_crypto_scalarmult_ristretto255_base')) { |
|
228 |
/** |
|
229 |
* @see ParagonIE_Sodium_Compat::crypto_scalarmult_ristretto255_base() |
|
230 |
* @param string $n |
|
231 |
* @return string |
|
232 |
* @throws SodiumException |
|
233 |
* @throws TypeError |
|
234 |
*/ |
|
235 |
function sodium_crypto_scalarmult_ristretto255_base($n) |
|
236 |
{ |
|
237 |
return ParagonIE_Sodium_Compat::scalarmult_ristretto255_base($n, true); |
|
238 |
} |
|
239 |
} |