libsodium.stub.php 9.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237
  1. <?php
  2. /** @generate-class-entries */
  3. function sodium_crypto_aead_aes256gcm_is_available(): bool {}
  4. #ifdef HAVE_AESGCM
  5. function sodium_crypto_aead_aes256gcm_decrypt(string $ciphertext, string $additional_data, string $nonce, string $key): string|false {}
  6. function sodium_crypto_aead_aes256gcm_encrypt(string $message, string $additional_data, string $nonce, string $key): string {}
  7. function sodium_crypto_aead_aes256gcm_keygen(): string {}
  8. #endif
  9. function sodium_crypto_aead_chacha20poly1305_decrypt(string $ciphertext, string $additional_data, string $nonce, string $key): string|false {}
  10. function sodium_crypto_aead_chacha20poly1305_encrypt(string $message, string $additional_data, string $nonce, string $key): string {}
  11. function sodium_crypto_aead_chacha20poly1305_keygen(): string {}
  12. function sodium_crypto_aead_chacha20poly1305_ietf_decrypt(string $ciphertext, string $additional_data, string $nonce, string $key): string|false {}
  13. function sodium_crypto_aead_chacha20poly1305_ietf_encrypt(string $message, string $additional_data, string $nonce, string $key): string {}
  14. function sodium_crypto_aead_chacha20poly1305_ietf_keygen(): string {}
  15. #ifdef crypto_aead_xchacha20poly1305_IETF_NPUBBYTES
  16. function sodium_crypto_aead_xchacha20poly1305_ietf_decrypt(string $ciphertext, string $additional_data, string $nonce, string $key): string|false {}
  17. function sodium_crypto_aead_xchacha20poly1305_ietf_keygen(): string {}
  18. function sodium_crypto_aead_xchacha20poly1305_ietf_encrypt(string $message, string $additional_data, string $nonce, string $key): string {}
  19. #endif
  20. function sodium_crypto_auth(string $message, string $key): string {}
  21. function sodium_crypto_auth_keygen(): string {}
  22. function sodium_crypto_auth_verify(string $mac, string $message, string $key): bool {}
  23. function sodium_crypto_box(string $message, string $nonce, string $key_pair): string {}
  24. function sodium_crypto_box_keypair(): string {}
  25. function sodium_crypto_box_seed_keypair(string $seed): string {}
  26. function sodium_crypto_box_keypair_from_secretkey_and_publickey(string $secret_key, string $public_key): string {}
  27. function sodium_crypto_box_open(string $ciphertext, string $nonce, string $key_pair): string|false {}
  28. function sodium_crypto_box_publickey(string $key_pair): string {}
  29. function sodium_crypto_box_publickey_from_secretkey(string $secret_key): string {}
  30. function sodium_crypto_box_seal(string $message, string $public_key): string {}
  31. function sodium_crypto_box_seal_open(string $ciphertext, string $key_pair): string|false {}
  32. function sodium_crypto_box_secretkey(string $key_pair): string {}
  33. #ifdef crypto_core_ristretto255_HASHBYTES
  34. function sodium_crypto_core_ristretto255_add(string $p, string $q): string {}
  35. function sodium_crypto_core_ristretto255_from_hash(string $s): string {}
  36. function sodium_crypto_core_ristretto255_is_valid_point(string $s): bool {}
  37. function sodium_crypto_core_ristretto255_random(): string {}
  38. function sodium_crypto_core_ristretto255_scalar_add(string $x, string $y): string {}
  39. function sodium_crypto_core_ristretto255_scalar_complement(string $s): string {}
  40. function sodium_crypto_core_ristretto255_scalar_invert(string $s): string {}
  41. function sodium_crypto_core_ristretto255_scalar_mul(string $x, string $y): string {}
  42. function sodium_crypto_core_ristretto255_scalar_negate(string $s): string {}
  43. function sodium_crypto_core_ristretto255_scalar_random(): string {}
  44. function sodium_crypto_core_ristretto255_scalar_reduce(string $s): string {}
  45. function sodium_crypto_core_ristretto255_scalar_sub(string $x, string $y): string {}
  46. function sodium_crypto_core_ristretto255_sub(string $p, string $q): string {}
  47. #endif
  48. function sodium_crypto_kx_keypair(): string {}
  49. function sodium_crypto_kx_publickey(string $key_pair): string {}
  50. function sodium_crypto_kx_secretkey(string $key_pair): string {}
  51. function sodium_crypto_kx_seed_keypair(string $seed): string {}
  52. /** @return array<int, string> */
  53. function sodium_crypto_kx_client_session_keys(string $client_key_pair, string $server_key): array {}
  54. /** @return array<int, string> */
  55. function sodium_crypto_kx_server_session_keys(string $server_key_pair, string $client_key): array {}
  56. function sodium_crypto_generichash(string $message, string $key = "", int $length = SODIUM_CRYPTO_GENERICHASH_BYTES): string {}
  57. function sodium_crypto_generichash_keygen(): string {}
  58. function sodium_crypto_generichash_init(string $key = "", int $length = SODIUM_CRYPTO_GENERICHASH_BYTES): string {}
  59. /** @return true */
  60. function sodium_crypto_generichash_update(string &$state, string $message): bool {}
  61. function sodium_crypto_generichash_final(string &$state, int $length = SODIUM_CRYPTO_GENERICHASH_BYTES): string {}
  62. function sodium_crypto_kdf_derive_from_key(int $subkey_length, int $subkey_id, string $context, string $key): string {}
  63. function sodium_crypto_kdf_keygen(): string {}
  64. #ifdef crypto_pwhash_SALTBYTES
  65. function sodium_crypto_pwhash(int $length, string $password, string $salt, int $opslimit, int $memlimit, int $algo = SODIUM_CRYPTO_PWHASH_ALG_DEFAULT): string {}
  66. function sodium_crypto_pwhash_str(string $password, int $opslimit, int $memlimit): string {}
  67. function sodium_crypto_pwhash_str_verify(string $hash, string $password): bool {}
  68. #endif
  69. #if SODIUM_LIBRARY_VERSION_MAJOR > 9 || (SODIUM_LIBRARY_VERSION_MAJOR == 9 && SODIUM_LIBRARY_VERSION_MINOR >= 6)
  70. function sodium_crypto_pwhash_str_needs_rehash(string $password, int $opslimit, int $memlimit): bool {}
  71. #endif
  72. #ifdef crypto_pwhash_scryptsalsa208sha256_SALTBYTES
  73. function sodium_crypto_pwhash_scryptsalsa208sha256(int $length, string $password, string $salt, int $opslimit, int $memlimit): string {}
  74. function sodium_crypto_pwhash_scryptsalsa208sha256_str(string $password, int $opslimit, int $memlimit): string {}
  75. function sodium_crypto_pwhash_scryptsalsa208sha256_str_verify(string $hash, string $password): bool {}
  76. #endif
  77. function sodium_crypto_scalarmult(string $n, string $p): string {}
  78. #ifdef crypto_core_ristretto255_HASHBYTES
  79. function sodium_crypto_scalarmult_ristretto255(string $n, string $p): string {}
  80. function sodium_crypto_scalarmult_ristretto255_base(string $n): string {}
  81. #endif
  82. function sodium_crypto_secretbox(string $message, string $nonce, string $key): string {}
  83. function sodium_crypto_secretbox_keygen(): string {}
  84. function sodium_crypto_secretbox_open(string $ciphertext, string $nonce, string $key): string|false {}
  85. #ifdef crypto_secretstream_xchacha20poly1305_ABYTES
  86. function sodium_crypto_secretstream_xchacha20poly1305_keygen(): string {}
  87. /** @return array<int, string> */
  88. function sodium_crypto_secretstream_xchacha20poly1305_init_push(string $key): array {}
  89. function sodium_crypto_secretstream_xchacha20poly1305_push(string &$state, string $message, string $additional_data = "", int $tag = SODIUM_CRYPTO_SECRETSTREAM_XCHACHA20POLY1305_TAG_MESSAGE): string {}
  90. function sodium_crypto_secretstream_xchacha20poly1305_init_pull(string $header, string $key): string {}
  91. /** @return array<int, int|string>|false */
  92. function sodium_crypto_secretstream_xchacha20poly1305_pull(string &$state, string $ciphertext, string $additional_data = ""): array|false {}
  93. function sodium_crypto_secretstream_xchacha20poly1305_rekey(string &$state): void {}
  94. #endif
  95. function sodium_crypto_shorthash(string $message, string $key): string {}
  96. function sodium_crypto_shorthash_keygen(): string {}
  97. function sodium_crypto_sign(string $message, string $secret_key): string {}
  98. function sodium_crypto_sign_detached(string $message, string $secret_key): string {}
  99. function sodium_crypto_sign_ed25519_pk_to_curve25519(string $public_key): string {}
  100. function sodium_crypto_sign_ed25519_sk_to_curve25519(string $secret_key): string {}
  101. function sodium_crypto_sign_keypair(): string {}
  102. function sodium_crypto_sign_keypair_from_secretkey_and_publickey(string $secret_key, string $public_key): string {}
  103. function sodium_crypto_sign_open(string $signed_message, string $public_key): string|false {}
  104. function sodium_crypto_sign_publickey(string $key_pair): string {}
  105. function sodium_crypto_sign_secretkey(string $key_pair): string {}
  106. function sodium_crypto_sign_publickey_from_secretkey(string $secret_key): string {}
  107. function sodium_crypto_sign_seed_keypair(string $seed): string {}
  108. function sodium_crypto_sign_verify_detached(string $signature, string $message, string $public_key): bool {}
  109. function sodium_crypto_stream(int $length, string $nonce, string $key): string {}
  110. function sodium_crypto_stream_keygen(): string {}
  111. function sodium_crypto_stream_xor(string $message, string $nonce, string $key): string {}
  112. #if defined(crypto_stream_xchacha20_KEYBYTES)
  113. function sodium_crypto_stream_xchacha20(int $length, string $nonce, string $key): string {}
  114. function sodium_crypto_stream_xchacha20_keygen(): string {}
  115. function sodium_crypto_stream_xchacha20_xor(string $message, string $nonce, string $key): string {}
  116. #endif
  117. function sodium_add(string &$string1, string $string2): void {}
  118. function sodium_compare(string $string1, string $string2): int {}
  119. function sodium_increment(string &$string): void {}
  120. function sodium_memcmp(string $string1, string $string2): int {}
  121. function sodium_memzero(string &$string): void {}
  122. function sodium_pad(string $string, int $block_size): string {}
  123. function sodium_unpad(string $string, int $block_size): string {}
  124. function sodium_bin2hex(string $string): string {}
  125. function sodium_hex2bin(string $string, string $ignore = ""): string {}
  126. #ifdef sodium_base64_VARIANT_ORIGINAL
  127. function sodium_bin2base64(string $string, int $id): string {}
  128. function sodium_base642bin(string $string, int $id, string $ignore = ""): string {}
  129. #endif
  130. /** @alias sodium_crypto_box_publickey_from_secretkey */
  131. function sodium_crypto_scalarmult_base(string $secret_key): string {}
  132. class SodiumException extends Exception {}