| 1 | 1 |
new file mode 100644 |
| ... | ... |
@@ -0,0 +1,43 @@ |
| 1 |
+<?php |
|
| 2 |
+ |
|
| 3 |
+if (!is_callable('sodium_crypto_stream_xchacha20')) {
|
|
| 4 |
+ /** |
|
| 5 |
+ * @see ParagonIE_Sodium_Compat::crypto_stream_xchacha20() |
|
| 6 |
+ * @param int $len |
|
| 7 |
+ * @param string $nonce |
|
| 8 |
+ * @param string $key |
|
| 9 |
+ * @return string |
|
| 10 |
+ * @throws SodiumException |
|
| 11 |
+ * @throws TypeError |
|
| 12 |
+ */ |
|
| 13 |
+ function sodium_crypto_stream_xchacha20($len, $nonce, $key) |
|
| 14 |
+ {
|
|
| 15 |
+ return ParagonIE_Sodium_Compat::crypto_stream_xchacha20($len, $nonce, $key, true); |
|
| 16 |
+ } |
|
| 17 |
+} |
|
| 18 |
+if (!is_callable('sodium_crypto_stream_xchacha20_keygen')) {
|
|
| 19 |
+ /** |
|
| 20 |
+ * @see ParagonIE_Sodium_Compat::crypto_stream_xchacha20_keygen() |
|
| 21 |
+ * @return string |
|
| 22 |
+ * @throws Exception |
|
| 23 |
+ */ |
|
| 24 |
+ function sodium_crypto_stream_xchacha20_keygen() |
|
| 25 |
+ {
|
|
| 26 |
+ return ParagonIE_Sodium_Compat::crypto_stream_xchacha20_keygen(); |
|
| 27 |
+ } |
|
| 28 |
+} |
|
| 29 |
+if (!is_callable('sodium_crypto_stream_xchacha20_xor')) {
|
|
| 30 |
+ /** |
|
| 31 |
+ * @see ParagonIE_Sodium_Compat::crypto_stream_xchacha20_xor() |
|
| 32 |
+ * @param string $message |
|
| 33 |
+ * @param string $nonce |
|
| 34 |
+ * @param string $key |
|
| 35 |
+ * @return string |
|
| 36 |
+ * @throws SodiumException |
|
| 37 |
+ * @throws TypeError |
|
| 38 |
+ */ |
|
| 39 |
+ function sodium_crypto_stream_xchacha20_xor($message, $nonce, $key) |
|
| 40 |
+ {
|
|
| 41 |
+ return ParagonIE_Sodium_Compat::crypto_stream_xchacha20_xor($message, $nonce, $key, true); |
|
| 42 |
+ } |
|
| 43 |
+} |