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
if (\Sodium\crypto_sign_verify_detached($signature, $message, $alice_pk)) {
181
-
echo 'OK', PHP_EOL;
182
-
} else {
183
-
throw new Exception('Invalid signature');
184
-
}
185
-
```
186
-
187
-
The polyfill does not expose this API on PHP < 5.3, or if you have the PHP
188
-
extension installed already.
189
-
190
163
## General-Use Polyfill
191
164
192
165
If your users are on PHP < 5.3, or you want to write code that will work
@@ -212,7 +185,7 @@ if (ParagonIE_Sodium_Compat::crypto_sign_verify_detached($signature, $message, $
212
185
}
213
186
```
214
187
215
-
Generally: If you replace `\Sodium\ ` with `ParagonIE_Sodium_Compat::`, any
188
+
Generally: If you replace `sodium_` with `ParagonIE_Sodium_Compat::`, any
216
189
code already written for the libsodium PHP extension should work with our
217
190
polyfill without additional code changes.
218
191
@@ -254,26 +227,6 @@ if (ParagonIE_Sodium_Compat::polyfill_is_fast()) {
254
227
}
255
228
```
256
229
257
-
### Help, my PHP only has 32-Bit Integers! It's super slow!
258
-
259
-
If the `PHP_INT_SIZE` constant equals `4` instead of `8` (PHP 5 on Windows,
260
-
Linux on i386, etc.), you will run into **significant performance issues**.
261
-
262
-
In particular: public-key cryptography (encryption and signatures)
263
-
is affected. There is nothing we can do about that.
264
-
265
-
The root cause of these performance issues has to do with implementing cryptography
266
-
algorithms in constant-time using 16-bit limbs (to avoid overflow) in pure PHP.
267
-
268
-
To mitigate these performance issues, simply install PHP 7.2 or newer and enable
269
-
the `sodium` extension.
270
-
271
-
Affected users are encouraged to install the sodium extension (or libsodium from
272
-
older version of PHP).
273
-
274
-
Windows users on PHP 5 may be able to simply upgrade to PHP 7 and the slowdown
275
-
will be greatly reduced.
276
-
277
230
## Documentation
278
231
279
232
First, you'll want to read the [Libsodium Quick Reference](https://paragonie.com/blog/2017/06/libsodium-quick-reference-quick-comparison-similar-functions-and-which-one-use).
0 commit comments