From 93108d703290dcd3a8e4d9a8b2af0c1928f6adcb Mon Sep 17 00:00:00 2001 From: Lucas Petrino Date: Tue, 18 Mar 2025 12:50:30 +1300 Subject: [PATCH] Update to sodium 1.0.20.1 to .NET 8 --- .gitattributes | 2 + .../CSSUDII.Sodium.Interop.csproj | 8 +- .../Generated/Libsodium.cs | 191 +- .../Generated/NativeAnnotationAttribute.cs | 23 + .../Generated/NativeTypeNameAttribute.cs | 2 +- .../Generated/crypto_aead_aes256gcm_state.cs | 16 + .../Generated/crypto_auth_hmacsha256_state.cs | 2 +- .../crypto_auth_hmacsha512256_state.cs | 2 +- .../crypto_generichash_blake2b_state.cs | 16 + .../Generated/crypto_hash_sha256_state.cs | 28 + .../Generated/crypto_hash_sha512_state.cs | 34 + .../crypto_onetimeauth_poly1305_state.cs | 16 + ...to_secretstream_xchacha20poly1305_state.cs | 34 + .../Generated/crypto_sign_ed25519ph_state.cs | 2 +- .../Generated/randombytes_implementation.cs | 2 +- .../Libsodium.Manual.cs | 2 +- .../CSSUDII.Sodium.Tests.csproj | 6 +- .../GenericHashBlake2BTest.cs | 6 +- .../HelpersTest.cs | 2 +- .../SecretBoxTest.cs | 4 +- SpaceWizards.Sodium.sln => CSSUDII.Sodium.sln | 6 +- .../CSSUDII.Sodium.csproj | 6 +- .../CryptoAeadXChaCha20Poly1305Ietf.cs | 2 +- .../CryptoBox.cs | 2 +- .../CryptoGenericHashBlake2B.cs | 4 +- .../SodiumCore.cs | 4 +- .../SodiumException.cs | 2 +- .../SodiumHelpers.cs | 2 +- .../SodiumInitException.cs | 2 +- Directory.build.props | 4 +- .../Generated/Libsodium.cs | 3053 +++++++++++++++++ .../Generated/NativeAnnotationAttribute.cs | 23 + .../Generated/NativeTypeNameAttribute.cs | 23 + .../Generated/crypto_aead_aes256gcm_state.cs | 16 + .../Generated/crypto_auth_hmacsha256_state.cs | 9 + .../crypto_auth_hmacsha512256_state.cs | 9 + .../crypto_generichash_blake2b_state.cs | 16 + .../Generated/crypto_hash_sha256_state.cs | 28 + .../Generated/crypto_hash_sha512_state.cs | 34 + .../crypto_onetimeauth_poly1305_state.cs | 16 + ...to_secretstream_xchacha20poly1305_state.cs | 34 + .../Generated/crypto_sign_ed25519ph_state.cs | 7 + .../Generated/randombytes_implementation.cs | 23 + .../Generated/NativeInheritanceAttribute.cs | 23 - .../Generated/SetsLastSystemErrorAttribute.cs | 17 - .../Generated/VtblIndexAttribute.cs | 23 - .../Generated/crypto_aead_aes256gcm_state.cs | 8 - .../crypto_generichash_blake2b_state.cs | 8 - .../Generated/crypto_hash_sha256_state.cs | 14 - .../Generated/crypto_hash_sha512_state.cs | 14 - .../crypto_onetimeauth_poly1305_state.cs | 8 - ...to_secretstream_xchacha20poly1305_state.cs | 14 - .../crypto_aead_aes256gcm_state.Manual.cs | 10 - ...crypto_generichash_blake2b_state.Manual.cs | 10 - ...rypto_onetimeauth_poly1305_state.Manual.cs | 10 - 55 files changed, 3600 insertions(+), 282 deletions(-) create mode 100644 .gitattributes rename SpaceWizards.Sodium.Interop/SpaceWizards.Sodium.Interop.csproj => CSSUDII.Sodium.Interop/CSSUDII.Sodium.Interop.csproj (71%) rename {SpaceWizards.Sodium.Interop => CSSUDII.Sodium.Interop}/Generated/Libsodium.cs (96%) create mode 100644 CSSUDII.Sodium.Interop/Generated/NativeAnnotationAttribute.cs rename {SpaceWizards.Sodium.Interop => CSSUDII.Sodium.Interop}/Generated/NativeTypeNameAttribute.cs (96%) create mode 100644 CSSUDII.Sodium.Interop/Generated/crypto_aead_aes256gcm_state.cs rename {SpaceWizards.Sodium.Interop => CSSUDII.Sodium.Interop}/Generated/crypto_auth_hmacsha256_state.cs (81%) rename {SpaceWizards.Sodium.Interop => CSSUDII.Sodium.Interop}/Generated/crypto_auth_hmacsha512256_state.cs (81%) create mode 100644 CSSUDII.Sodium.Interop/Generated/crypto_generichash_blake2b_state.cs create mode 100644 CSSUDII.Sodium.Interop/Generated/crypto_hash_sha256_state.cs create mode 100644 CSSUDII.Sodium.Interop/Generated/crypto_hash_sha512_state.cs create mode 100644 CSSUDII.Sodium.Interop/Generated/crypto_onetimeauth_poly1305_state.cs create mode 100644 CSSUDII.Sodium.Interop/Generated/crypto_secretstream_xchacha20poly1305_state.cs rename {SpaceWizards.Sodium.Interop => CSSUDII.Sodium.Interop}/Generated/crypto_sign_ed25519ph_state.cs (75%) rename {SpaceWizards.Sodium.Interop => CSSUDII.Sodium.Interop}/Generated/randombytes_implementation.cs (95%) rename {SpaceWizards.Sodium.Interop => CSSUDII.Sodium.Interop}/Libsodium.Manual.cs (90%) rename SpaceWizards.Sodium.Tests/SpaceWizards.Sodium.Tests.csproj => CSSUDII.Sodium.Tests/CSSUDII.Sodium.Tests.csproj (75%) rename {SpaceWizards.Sodium.Tests => CSSUDII.Sodium.Tests}/GenericHashBlake2BTest.cs (96%) rename {SpaceWizards.Sodium.Tests => CSSUDII.Sodium.Tests}/HelpersTest.cs (99%) rename {SpaceWizards.Sodium.Tests => CSSUDII.Sodium.Tests}/SecretBoxTest.cs (92%) rename SpaceWizards.Sodium.sln => CSSUDII.Sodium.sln (80%) rename SpaceWizards.Sodium/SpaceWizards.Sodium.csproj => CSSUDII.Sodium/CSSUDII.Sodium.csproj (70%) rename {SpaceWizards.Sodium => CSSUDII.Sodium}/CryptoAeadXChaCha20Poly1305Ietf.cs (99%) rename {SpaceWizards.Sodium => CSSUDII.Sodium}/CryptoBox.cs (98%) rename {SpaceWizards.Sodium => CSSUDII.Sodium}/CryptoGenericHashBlake2B.cs (98%) rename {SpaceWizards.Sodium => CSSUDII.Sodium}/SodiumCore.cs (89%) rename {SpaceWizards.Sodium => CSSUDII.Sodium}/SodiumException.cs (88%) rename {SpaceWizards.Sodium => CSSUDII.Sodium}/SodiumHelpers.cs (99%) rename {SpaceWizards.Sodium => CSSUDII.Sodium}/SodiumInitException.cs (89%) create mode 100644 Scripts/CSSUDII.Sodium.Interop/Generated/Libsodium.cs create mode 100644 Scripts/CSSUDII.Sodium.Interop/Generated/NativeAnnotationAttribute.cs create mode 100644 Scripts/CSSUDII.Sodium.Interop/Generated/NativeTypeNameAttribute.cs create mode 100644 Scripts/CSSUDII.Sodium.Interop/Generated/crypto_aead_aes256gcm_state.cs create mode 100644 Scripts/CSSUDII.Sodium.Interop/Generated/crypto_auth_hmacsha256_state.cs create mode 100644 Scripts/CSSUDII.Sodium.Interop/Generated/crypto_auth_hmacsha512256_state.cs create mode 100644 Scripts/CSSUDII.Sodium.Interop/Generated/crypto_generichash_blake2b_state.cs create mode 100644 Scripts/CSSUDII.Sodium.Interop/Generated/crypto_hash_sha256_state.cs create mode 100644 Scripts/CSSUDII.Sodium.Interop/Generated/crypto_hash_sha512_state.cs create mode 100644 Scripts/CSSUDII.Sodium.Interop/Generated/crypto_onetimeauth_poly1305_state.cs create mode 100644 Scripts/CSSUDII.Sodium.Interop/Generated/crypto_secretstream_xchacha20poly1305_state.cs create mode 100644 Scripts/CSSUDII.Sodium.Interop/Generated/crypto_sign_ed25519ph_state.cs create mode 100644 Scripts/CSSUDII.Sodium.Interop/Generated/randombytes_implementation.cs delete mode 100644 SpaceWizards.Sodium.Interop/Generated/NativeInheritanceAttribute.cs delete mode 100644 SpaceWizards.Sodium.Interop/Generated/SetsLastSystemErrorAttribute.cs delete mode 100644 SpaceWizards.Sodium.Interop/Generated/VtblIndexAttribute.cs delete mode 100644 SpaceWizards.Sodium.Interop/Generated/crypto_aead_aes256gcm_state.cs delete mode 100644 SpaceWizards.Sodium.Interop/Generated/crypto_generichash_blake2b_state.cs delete mode 100644 SpaceWizards.Sodium.Interop/Generated/crypto_hash_sha256_state.cs delete mode 100644 SpaceWizards.Sodium.Interop/Generated/crypto_hash_sha512_state.cs delete mode 100644 SpaceWizards.Sodium.Interop/Generated/crypto_onetimeauth_poly1305_state.cs delete mode 100644 SpaceWizards.Sodium.Interop/Generated/crypto_secretstream_xchacha20poly1305_state.cs delete mode 100644 SpaceWizards.Sodium.Interop/crypto_aead_aes256gcm_state.Manual.cs delete mode 100644 SpaceWizards.Sodium.Interop/crypto_generichash_blake2b_state.Manual.cs delete mode 100644 SpaceWizards.Sodium.Interop/crypto_onetimeauth_poly1305_state.Manual.cs diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..079f902 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,2 @@ +* text=auto +*.sln text eol=crlf \ No newline at end of file diff --git a/SpaceWizards.Sodium.Interop/SpaceWizards.Sodium.Interop.csproj b/CSSUDII.Sodium.Interop/CSSUDII.Sodium.Interop.csproj similarity index 71% rename from SpaceWizards.Sodium.Interop/SpaceWizards.Sodium.Interop.csproj rename to CSSUDII.Sodium.Interop/CSSUDII.Sodium.Interop.csproj index 9c4239a..ade3d78 100644 --- a/SpaceWizards.Sodium.Interop/SpaceWizards.Sodium.Interop.csproj +++ b/CSSUDII.Sodium.Interop/CSSUDII.Sodium.Interop.csproj @@ -1,12 +1,12 @@ - net6.0 + net8.0 enable enable true - SpaceWizards.Sodium.Interop - 1.0.18-beta4 + CSSUDII.Sodium.Interop + 1.0.20.1 true Native API binding for libsodium. CS1591 @@ -18,7 +18,7 @@ - + diff --git a/SpaceWizards.Sodium.Interop/Generated/Libsodium.cs b/CSSUDII.Sodium.Interop/Generated/Libsodium.cs similarity index 96% rename from SpaceWizards.Sodium.Interop/Generated/Libsodium.cs rename to CSSUDII.Sodium.Interop/Generated/Libsodium.cs index 88ca206..af4228f 100644 --- a/SpaceWizards.Sodium.Interop/Generated/Libsodium.cs +++ b/CSSUDII.Sodium.Interop/Generated/Libsodium.cs @@ -1,7 +1,7 @@ using System; using System.Runtime.InteropServices; -namespace SpaceWizards.Sodium.Interop +namespace CSSUDII.Sodium.Interop { public static unsafe partial class Libsodium { @@ -69,7 +69,7 @@ namespace SpaceWizards.Sodium.Interop public static extern int crypto_aead_aes256gcm_decrypt_detached_afternm([NativeTypeName("unsigned char *")] byte* m, [NativeTypeName("unsigned char *")] byte* nsec, [NativeTypeName("const unsigned char *")] byte* c, [NativeTypeName("unsigned long long")] ulong clen, [NativeTypeName("const unsigned char *")] byte* mac, [NativeTypeName("const unsigned char *")] byte* ad, [NativeTypeName("unsigned long long")] ulong adlen, [NativeTypeName("const unsigned char *")] byte* npub, [NativeTypeName("const crypto_aead_aes256gcm_state *")] crypto_aead_aes256gcm_state* ctx_); [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void crypto_aead_aes256gcm_keygen([NativeTypeName("unsigned char [32]")] byte* k); + public static extern void crypto_aead_aes256gcm_keygen([NativeTypeName("unsigned char[32]")] byte* k); [NativeTypeName("#define crypto_aead_aes256gcm_KEYBYTES 32U")] public const uint crypto_aead_aes256gcm_KEYBYTES = 32U; @@ -119,7 +119,7 @@ namespace SpaceWizards.Sodium.Interop public static extern int crypto_aead_chacha20poly1305_ietf_decrypt_detached([NativeTypeName("unsigned char *")] byte* m, [NativeTypeName("unsigned char *")] byte* nsec, [NativeTypeName("const unsigned char *")] byte* c, [NativeTypeName("unsigned long long")] ulong clen, [NativeTypeName("const unsigned char *")] byte* mac, [NativeTypeName("const unsigned char *")] byte* ad, [NativeTypeName("unsigned long long")] ulong adlen, [NativeTypeName("const unsigned char *")] byte* npub, [NativeTypeName("const unsigned char *")] byte* k); [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void crypto_aead_chacha20poly1305_ietf_keygen([NativeTypeName("unsigned char [32]")] byte* k); + public static extern void crypto_aead_chacha20poly1305_ietf_keygen([NativeTypeName("unsigned char[32]")] byte* k); [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] [return: NativeTypeName("size_t")] @@ -154,7 +154,7 @@ namespace SpaceWizards.Sodium.Interop public static extern int crypto_aead_chacha20poly1305_decrypt_detached([NativeTypeName("unsigned char *")] byte* m, [NativeTypeName("unsigned char *")] byte* nsec, [NativeTypeName("const unsigned char *")] byte* c, [NativeTypeName("unsigned long long")] ulong clen, [NativeTypeName("const unsigned char *")] byte* mac, [NativeTypeName("const unsigned char *")] byte* ad, [NativeTypeName("unsigned long long")] ulong adlen, [NativeTypeName("const unsigned char *")] byte* npub, [NativeTypeName("const unsigned char *")] byte* k); [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void crypto_aead_chacha20poly1305_keygen([NativeTypeName("unsigned char [32]")] byte* k); + public static extern void crypto_aead_chacha20poly1305_keygen([NativeTypeName("unsigned char[32]")] byte* k); [NativeTypeName("#define crypto_aead_chacha20poly1305_ietf_KEYBYTES 32U")] public const uint crypto_aead_chacha20poly1305_ietf_KEYBYTES = 32U; @@ -234,7 +234,7 @@ namespace SpaceWizards.Sodium.Interop public static extern int crypto_aead_xchacha20poly1305_ietf_decrypt_detached([NativeTypeName("unsigned char *")] byte* m, [NativeTypeName("unsigned char *")] byte* nsec, [NativeTypeName("const unsigned char *")] byte* c, [NativeTypeName("unsigned long long")] ulong clen, [NativeTypeName("const unsigned char *")] byte* mac, [NativeTypeName("const unsigned char *")] byte* ad, [NativeTypeName("unsigned long long")] ulong adlen, [NativeTypeName("const unsigned char *")] byte* npub, [NativeTypeName("const unsigned char *")] byte* k); [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void crypto_aead_xchacha20poly1305_ietf_keygen([NativeTypeName("unsigned char [32]")] byte* k); + public static extern void crypto_aead_xchacha20poly1305_ietf_keygen([NativeTypeName("unsigned char[32]")] byte* k); [NativeTypeName("#define crypto_aead_xchacha20poly1305_ietf_KEYBYTES 32U")] public const uint crypto_aead_xchacha20poly1305_ietf_KEYBYTES = 32U; @@ -285,7 +285,7 @@ namespace SpaceWizards.Sodium.Interop public static extern int crypto_auth_verify([NativeTypeName("const unsigned char *")] byte* h, [NativeTypeName("const unsigned char *")] byte* @in, [NativeTypeName("unsigned long long")] ulong inlen, [NativeTypeName("const unsigned char *")] byte* k); [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void crypto_auth_keygen([NativeTypeName("unsigned char [32]")] byte* k); + public static extern void crypto_auth_keygen([NativeTypeName("unsigned char[32]")] byte* k); [NativeTypeName("#define crypto_auth_BYTES crypto_auth_hmacsha512256_BYTES")] public const uint crypto_auth_BYTES = 32U; @@ -294,7 +294,7 @@ namespace SpaceWizards.Sodium.Interop public const uint crypto_auth_KEYBYTES = 32U; [NativeTypeName("#define crypto_auth_PRIMITIVE \"hmacsha512256\"")] - public static ReadOnlySpan crypto_auth_PRIMITIVE => new byte[] { 0x68, 0x6D, 0x61, 0x63, 0x73, 0x68, 0x61, 0x35, 0x31, 0x32, 0x32, 0x35, 0x36, 0x00 }; + public static ReadOnlySpan crypto_auth_PRIMITIVE => "hmacsha512256"u8; [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] [return: NativeTypeName("size_t")] @@ -324,7 +324,7 @@ namespace SpaceWizards.Sodium.Interop public static extern int crypto_auth_hmacsha256_final(crypto_auth_hmacsha256_state* state, [NativeTypeName("unsigned char *")] byte* @out); [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void crypto_auth_hmacsha256_keygen([NativeTypeName("unsigned char [32]")] byte* k); + public static extern void crypto_auth_hmacsha256_keygen([NativeTypeName("unsigned char[32]")] byte* k); [NativeTypeName("#define crypto_auth_hmacsha256_BYTES 32U")] public const uint crypto_auth_hmacsha256_BYTES = 32U; @@ -360,7 +360,7 @@ namespace SpaceWizards.Sodium.Interop public static extern int crypto_auth_hmacsha512_final([NativeTypeName("crypto_auth_hmacsha512_state *")] crypto_auth_hmacsha512256_state* state, [NativeTypeName("unsigned char *")] byte* @out); [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void crypto_auth_hmacsha512_keygen([NativeTypeName("unsigned char [32]")] byte* k); + public static extern void crypto_auth_hmacsha512_keygen([NativeTypeName("unsigned char[32]")] byte* k); [NativeTypeName("#define crypto_auth_hmacsha512_BYTES 64U")] public const uint crypto_auth_hmacsha512_BYTES = 64U; @@ -396,7 +396,7 @@ namespace SpaceWizards.Sodium.Interop public static extern int crypto_auth_hmacsha512256_final(crypto_auth_hmacsha512256_state* state, [NativeTypeName("unsigned char *")] byte* @out); [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void crypto_auth_hmacsha512256_keygen([NativeTypeName("unsigned char [32]")] byte* k); + public static extern void crypto_auth_hmacsha512256_keygen([NativeTypeName("unsigned char[32]")] byte* k); [NativeTypeName("#define crypto_auth_hmacsha512256_BYTES 32U")] public const uint crypto_auth_hmacsha512256_BYTES = 32U; @@ -518,7 +518,7 @@ namespace SpaceWizards.Sodium.Interop public const ulong crypto_box_MESSAGEBYTES_MAX = (((0xffffffffffffffffUL) < (0xffffffffffffffffUL) ? (0xffffffffffffffffUL) : (0xffffffffffffffffUL)) - 16U); [NativeTypeName("#define crypto_box_PRIMITIVE \"curve25519xsalsa20poly1305\"")] - public static ReadOnlySpan crypto_box_PRIMITIVE => new byte[] { 0x63, 0x75, 0x72, 0x76, 0x65, 0x32, 0x35, 0x35, 0x31, 0x39, 0x78, 0x73, 0x61, 0x6C, 0x73, 0x61, 0x32, 0x30, 0x70, 0x6F, 0x6C, 0x79, 0x31, 0x33, 0x30, 0x35, 0x00 }; + public static ReadOnlySpan crypto_box_PRIMITIVE => "curve25519xsalsa20poly1305"u8; [NativeTypeName("#define crypto_box_BEFORENMBYTES crypto_box_curve25519xsalsa20poly1305_BEFORENMBYTES")] public const uint crypto_box_BEFORENMBYTES = 32U; @@ -744,6 +744,7 @@ namespace SpaceWizards.Sodium.Interop public static extern int crypto_core_ed25519_from_uniform([NativeTypeName("unsigned char *")] byte* p, [NativeTypeName("const unsigned char *")] byte* r); [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [Obsolete] public static extern int crypto_core_ed25519_from_hash([NativeTypeName("unsigned char *")] byte* p, [NativeTypeName("const unsigned char *")] byte* h); [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] @@ -950,18 +951,22 @@ namespace SpaceWizards.Sodium.Interop [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] [return: NativeTypeName("size_t")] + [Obsolete] public static extern nuint crypto_core_salsa208_outputbytes(); [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] [return: NativeTypeName("size_t")] + [Obsolete] public static extern nuint crypto_core_salsa208_inputbytes(); [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] [return: NativeTypeName("size_t")] + [Obsolete] public static extern nuint crypto_core_salsa208_keybytes(); [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] [return: NativeTypeName("size_t")] + [Obsolete] public static extern nuint crypto_core_salsa208_constbytes(); [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] @@ -1055,7 +1060,7 @@ namespace SpaceWizards.Sodium.Interop public static extern int crypto_generichash_final([NativeTypeName("crypto_generichash_state *")] crypto_generichash_blake2b_state* state, [NativeTypeName("unsigned char *")] byte* @out, [NativeTypeName("const size_t")] nuint outlen); [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void crypto_generichash_keygen([NativeTypeName("unsigned char [32]")] byte* k); + public static extern void crypto_generichash_keygen([NativeTypeName("unsigned char[32]")] byte* k); [NativeTypeName("#define crypto_generichash_BYTES_MIN crypto_generichash_blake2b_BYTES_MIN")] public const uint crypto_generichash_BYTES_MIN = 16U; @@ -1076,7 +1081,7 @@ namespace SpaceWizards.Sodium.Interop public const uint crypto_generichash_KEYBYTES = 32U; [NativeTypeName("#define crypto_generichash_PRIMITIVE \"blake2b\"")] - public static ReadOnlySpan crypto_generichash_PRIMITIVE => new byte[] { 0x62, 0x6C, 0x61, 0x6B, 0x65, 0x32, 0x62, 0x00 }; + public static ReadOnlySpan crypto_generichash_PRIMITIVE => "blake2b"u8; [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] [return: NativeTypeName("size_t")] @@ -1133,7 +1138,7 @@ namespace SpaceWizards.Sodium.Interop public static extern int crypto_generichash_blake2b_final(crypto_generichash_blake2b_state* state, [NativeTypeName("unsigned char *")] byte* @out, [NativeTypeName("const size_t")] nuint outlen); [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void crypto_generichash_blake2b_keygen([NativeTypeName("unsigned char [32]")] byte* k); + public static extern void crypto_generichash_blake2b_keygen([NativeTypeName("unsigned char[32]")] byte* k); [NativeTypeName("#define crypto_generichash_blake2b_BYTES_MIN 16U")] public const uint crypto_generichash_blake2b_BYTES_MIN = 16U; @@ -1174,7 +1179,7 @@ namespace SpaceWizards.Sodium.Interop public const uint crypto_hash_BYTES = 64U; [NativeTypeName("#define crypto_hash_PRIMITIVE \"sha512\"")] - public static ReadOnlySpan crypto_hash_PRIMITIVE => new byte[] { 0x73, 0x68, 0x61, 0x35, 0x31, 0x32, 0x00 }; + public static ReadOnlySpan crypto_hash_PRIMITIVE => "sha512"u8; [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] [return: NativeTypeName("size_t")] @@ -1243,10 +1248,10 @@ namespace SpaceWizards.Sodium.Interop public static extern sbyte* crypto_kdf_primitive(); [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int crypto_kdf_derive_from_key([NativeTypeName("unsigned char *")] byte* subkey, [NativeTypeName("size_t")] nuint subkey_len, [NativeTypeName("uint64_t")] ulong subkey_id, [NativeTypeName("const char [8]")] sbyte* ctx, [NativeTypeName("const unsigned char [32]")] byte* key); + public static extern int crypto_kdf_derive_from_key([NativeTypeName("unsigned char *")] byte* subkey, [NativeTypeName("size_t")] nuint subkey_len, [NativeTypeName("uint64_t")] ulong subkey_id, [NativeTypeName("const char[8]")] sbyte* ctx, [NativeTypeName("const unsigned char[32]")] byte* key); [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void crypto_kdf_keygen([NativeTypeName("unsigned char [32]")] byte* k); + public static extern void crypto_kdf_keygen([NativeTypeName("unsigned char[32]")] byte* k); [NativeTypeName("#define crypto_kdf_BYTES_MIN crypto_kdf_blake2b_BYTES_MIN")] public const int crypto_kdf_BYTES_MIN = 16; @@ -1261,19 +1266,7 @@ namespace SpaceWizards.Sodium.Interop public const int crypto_kdf_KEYBYTES = 32; [NativeTypeName("#define crypto_kdf_PRIMITIVE \"blake2b\"")] - public static ReadOnlySpan crypto_kdf_PRIMITIVE => new byte[] { 0x62, 0x6C, 0x61, 0x6B, 0x65, 0x32, 0x62, 0x00 }; - - [NativeTypeName("#define crypto_kdf_blake2b_BYTES_MIN 16")] - public const int crypto_kdf_blake2b_BYTES_MIN = 16; - - [NativeTypeName("#define crypto_kdf_blake2b_BYTES_MAX 64")] - public const int crypto_kdf_blake2b_BYTES_MAX = 64; - - [NativeTypeName("#define crypto_kdf_blake2b_CONTEXTBYTES 8")] - public const int crypto_kdf_blake2b_CONTEXTBYTES = 8; - - [NativeTypeName("#define crypto_kdf_blake2b_KEYBYTES 32")] - public const int crypto_kdf_blake2b_KEYBYTES = 32; + public static ReadOnlySpan crypto_kdf_PRIMITIVE => "blake2b"u8; [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] [return: NativeTypeName("size_t")] @@ -1292,7 +1285,19 @@ namespace SpaceWizards.Sodium.Interop public static extern nuint crypto_kdf_blake2b_keybytes(); [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int crypto_kdf_blake2b_derive_from_key([NativeTypeName("unsigned char *")] byte* subkey, [NativeTypeName("size_t")] nuint subkey_len, [NativeTypeName("uint64_t")] ulong subkey_id, [NativeTypeName("const char [8]")] sbyte* ctx, [NativeTypeName("const unsigned char [32]")] byte* key); + public static extern int crypto_kdf_blake2b_derive_from_key([NativeTypeName("unsigned char *")] byte* subkey, [NativeTypeName("size_t")] nuint subkey_len, [NativeTypeName("uint64_t")] ulong subkey_id, [NativeTypeName("const char[8]")] sbyte* ctx, [NativeTypeName("const unsigned char[32]")] byte* key); + + [NativeTypeName("#define crypto_kdf_blake2b_BYTES_MIN 16")] + public const int crypto_kdf_blake2b_BYTES_MIN = 16; + + [NativeTypeName("#define crypto_kdf_blake2b_BYTES_MAX 64")] + public const int crypto_kdf_blake2b_BYTES_MAX = 64; + + [NativeTypeName("#define crypto_kdf_blake2b_CONTEXTBYTES 8")] + public const int crypto_kdf_blake2b_CONTEXTBYTES = 8; + + [NativeTypeName("#define crypto_kdf_blake2b_KEYBYTES 32")] + public const int crypto_kdf_blake2b_KEYBYTES = 32; [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] [return: NativeTypeName("size_t")] @@ -1315,16 +1320,16 @@ namespace SpaceWizards.Sodium.Interop public static extern sbyte* crypto_kx_primitive(); [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int crypto_kx_seed_keypair([NativeTypeName("unsigned char [32]")] byte* pk, [NativeTypeName("unsigned char [32]")] byte* sk, [NativeTypeName("const unsigned char [32]")] byte* seed); + public static extern int crypto_kx_seed_keypair([NativeTypeName("unsigned char[32]")] byte* pk, [NativeTypeName("unsigned char[32]")] byte* sk, [NativeTypeName("const unsigned char[32]")] byte* seed); [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int crypto_kx_keypair([NativeTypeName("unsigned char [32]")] byte* pk, [NativeTypeName("unsigned char [32]")] byte* sk); + public static extern int crypto_kx_keypair([NativeTypeName("unsigned char[32]")] byte* pk, [NativeTypeName("unsigned char[32]")] byte* sk); [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int crypto_kx_client_session_keys([NativeTypeName("unsigned char [32]")] byte* rx, [NativeTypeName("unsigned char [32]")] byte* tx, [NativeTypeName("const unsigned char [32]")] byte* client_pk, [NativeTypeName("const unsigned char [32]")] byte* client_sk, [NativeTypeName("const unsigned char [32]")] byte* server_pk); + public static extern int crypto_kx_client_session_keys([NativeTypeName("unsigned char[32]")] byte* rx, [NativeTypeName("unsigned char[32]")] byte* tx, [NativeTypeName("const unsigned char[32]")] byte* client_pk, [NativeTypeName("const unsigned char[32]")] byte* client_sk, [NativeTypeName("const unsigned char[32]")] byte* server_pk); [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int crypto_kx_server_session_keys([NativeTypeName("unsigned char [32]")] byte* rx, [NativeTypeName("unsigned char [32]")] byte* tx, [NativeTypeName("const unsigned char [32]")] byte* server_pk, [NativeTypeName("const unsigned char [32]")] byte* server_sk, [NativeTypeName("const unsigned char [32]")] byte* client_pk); + public static extern int crypto_kx_server_session_keys([NativeTypeName("unsigned char[32]")] byte* rx, [NativeTypeName("unsigned char[32]")] byte* tx, [NativeTypeName("const unsigned char[32]")] byte* server_pk, [NativeTypeName("const unsigned char[32]")] byte* server_sk, [NativeTypeName("const unsigned char[32]")] byte* client_pk); [NativeTypeName("#define crypto_kx_PUBLICKEYBYTES 32")] public const int crypto_kx_PUBLICKEYBYTES = 32; @@ -1339,7 +1344,7 @@ namespace SpaceWizards.Sodium.Interop public const int crypto_kx_SESSIONKEYBYTES = 32; [NativeTypeName("#define crypto_kx_PRIMITIVE \"x25519blake2b\"")] - public static ReadOnlySpan crypto_kx_PRIMITIVE => new byte[] { 0x78, 0x32, 0x35, 0x35, 0x31, 0x39, 0x62, 0x6C, 0x61, 0x6B, 0x65, 0x32, 0x62, 0x00 }; + public static ReadOnlySpan crypto_kx_PRIMITIVE => "x25519blake2b"u8; [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] [return: NativeTypeName("size_t")] @@ -1373,7 +1378,7 @@ namespace SpaceWizards.Sodium.Interop public static extern int crypto_onetimeauth_final([NativeTypeName("crypto_onetimeauth_state *")] crypto_onetimeauth_poly1305_state* state, [NativeTypeName("unsigned char *")] byte* @out); [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void crypto_onetimeauth_keygen([NativeTypeName("unsigned char [32]")] byte* k); + public static extern void crypto_onetimeauth_keygen([NativeTypeName("unsigned char[32]")] byte* k); [NativeTypeName("#define crypto_onetimeauth_BYTES crypto_onetimeauth_poly1305_BYTES")] public const uint crypto_onetimeauth_BYTES = 16U; @@ -1382,7 +1387,7 @@ namespace SpaceWizards.Sodium.Interop public const uint crypto_onetimeauth_KEYBYTES = 32U; [NativeTypeName("#define crypto_onetimeauth_PRIMITIVE \"poly1305\"")] - public static ReadOnlySpan crypto_onetimeauth_PRIMITIVE => new byte[] { 0x70, 0x6F, 0x6C, 0x79, 0x31, 0x33, 0x30, 0x35, 0x00 }; + public static ReadOnlySpan crypto_onetimeauth_PRIMITIVE => "poly1305"u8; [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] [return: NativeTypeName("size_t")] @@ -1412,7 +1417,7 @@ namespace SpaceWizards.Sodium.Interop public static extern int crypto_onetimeauth_poly1305_final(crypto_onetimeauth_poly1305_state* state, [NativeTypeName("unsigned char *")] byte* @out); [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void crypto_onetimeauth_poly1305_keygen([NativeTypeName("unsigned char [32]")] byte* k); + public static extern void crypto_onetimeauth_poly1305_keygen([NativeTypeName("unsigned char[32]")] byte* k); [NativeTypeName("#define crypto_onetimeauth_poly1305_BYTES 16U")] public const uint crypto_onetimeauth_poly1305_BYTES = 16U; @@ -1501,16 +1506,16 @@ namespace SpaceWizards.Sodium.Interop public static extern int crypto_pwhash([NativeTypeName("unsigned char *const")] byte* @out, [NativeTypeName("unsigned long long")] ulong outlen, [NativeTypeName("const char *const")] sbyte* passwd, [NativeTypeName("unsigned long long")] ulong passwdlen, [NativeTypeName("const unsigned char *const")] byte* salt, [NativeTypeName("unsigned long long")] ulong opslimit, [NativeTypeName("size_t")] nuint memlimit, int alg); [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int crypto_pwhash_str([NativeTypeName("char [128]")] sbyte* @out, [NativeTypeName("const char *const")] sbyte* passwd, [NativeTypeName("unsigned long long")] ulong passwdlen, [NativeTypeName("unsigned long long")] ulong opslimit, [NativeTypeName("size_t")] nuint memlimit); + public static extern int crypto_pwhash_str([NativeTypeName("char[128]")] sbyte* @out, [NativeTypeName("const char *const")] sbyte* passwd, [NativeTypeName("unsigned long long")] ulong passwdlen, [NativeTypeName("unsigned long long")] ulong opslimit, [NativeTypeName("size_t")] nuint memlimit); [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int crypto_pwhash_str_alg([NativeTypeName("char [128]")] sbyte* @out, [NativeTypeName("const char *const")] sbyte* passwd, [NativeTypeName("unsigned long long")] ulong passwdlen, [NativeTypeName("unsigned long long")] ulong opslimit, [NativeTypeName("size_t")] nuint memlimit, int alg); + public static extern int crypto_pwhash_str_alg([NativeTypeName("char[128]")] sbyte* @out, [NativeTypeName("const char *const")] sbyte* passwd, [NativeTypeName("unsigned long long")] ulong passwdlen, [NativeTypeName("unsigned long long")] ulong opslimit, [NativeTypeName("size_t")] nuint memlimit, int alg); [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int crypto_pwhash_str_verify([NativeTypeName("const char [128]")] sbyte* str, [NativeTypeName("const char *const")] sbyte* passwd, [NativeTypeName("unsigned long long")] ulong passwdlen); + public static extern int crypto_pwhash_str_verify([NativeTypeName("const char *")] sbyte* str, [NativeTypeName("const char *const")] sbyte* passwd, [NativeTypeName("unsigned long long")] ulong passwdlen); [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int crypto_pwhash_str_needs_rehash([NativeTypeName("const char [128]")] sbyte* str, [NativeTypeName("unsigned long long")] ulong opslimit, [NativeTypeName("size_t")] nuint memlimit); + public static extern int crypto_pwhash_str_needs_rehash([NativeTypeName("const char *")] sbyte* str, [NativeTypeName("unsigned long long")] ulong opslimit, [NativeTypeName("size_t")] nuint memlimit); [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] [return: NativeTypeName("const char *")] @@ -1544,7 +1549,7 @@ namespace SpaceWizards.Sodium.Interop public const uint crypto_pwhash_STRBYTES = 128U; [NativeTypeName("#define crypto_pwhash_STRPREFIX crypto_pwhash_argon2id_STRPREFIX")] - public static ReadOnlySpan crypto_pwhash_STRPREFIX => new byte[] { 0x24, 0x61, 0x72, 0x67, 0x6F, 0x6E, 0x32, 0x69, 0x64, 0x24, 0x00 }; + public static ReadOnlySpan crypto_pwhash_STRPREFIX => "$argon2id$"u8; [NativeTypeName("#define crypto_pwhash_OPSLIMIT_MIN crypto_pwhash_argon2id_OPSLIMIT_MIN")] public const uint crypto_pwhash_OPSLIMIT_MIN = 1U; @@ -1576,8 +1581,8 @@ namespace SpaceWizards.Sodium.Interop [NativeTypeName("#define crypto_pwhash_MEMLIMIT_SENSITIVE crypto_pwhash_argon2id_MEMLIMIT_SENSITIVE")] public const uint crypto_pwhash_MEMLIMIT_SENSITIVE = 1073741824U; - [NativeTypeName("#define crypto_pwhash_PRIMITIVE \"argon2i\"")] - public static ReadOnlySpan crypto_pwhash_PRIMITIVE => new byte[] { 0x61, 0x72, 0x67, 0x6F, 0x6E, 0x32, 0x69, 0x00 }; + [NativeTypeName("#define crypto_pwhash_PRIMITIVE \"argon2id,argon2i\"")] + public static ReadOnlySpan crypto_pwhash_PRIMITIVE => "argon2id,argon2i"u8; [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] public static extern int crypto_pwhash_argon2i_alg_argon2i13(); @@ -1654,13 +1659,13 @@ namespace SpaceWizards.Sodium.Interop public static extern int crypto_pwhash_argon2i([NativeTypeName("unsigned char *const")] byte* @out, [NativeTypeName("unsigned long long")] ulong outlen, [NativeTypeName("const char *const")] sbyte* passwd, [NativeTypeName("unsigned long long")] ulong passwdlen, [NativeTypeName("const unsigned char *const")] byte* salt, [NativeTypeName("unsigned long long")] ulong opslimit, [NativeTypeName("size_t")] nuint memlimit, int alg); [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int crypto_pwhash_argon2i_str([NativeTypeName("char [128]")] sbyte* @out, [NativeTypeName("const char *const")] sbyte* passwd, [NativeTypeName("unsigned long long")] ulong passwdlen, [NativeTypeName("unsigned long long")] ulong opslimit, [NativeTypeName("size_t")] nuint memlimit); + public static extern int crypto_pwhash_argon2i_str([NativeTypeName("char[128]")] sbyte* @out, [NativeTypeName("const char *const")] sbyte* passwd, [NativeTypeName("unsigned long long")] ulong passwdlen, [NativeTypeName("unsigned long long")] ulong opslimit, [NativeTypeName("size_t")] nuint memlimit); [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int crypto_pwhash_argon2i_str_verify([NativeTypeName("const char [128]")] sbyte* str, [NativeTypeName("const char *const")] sbyte* passwd, [NativeTypeName("unsigned long long")] ulong passwdlen); + public static extern int crypto_pwhash_argon2i_str_verify([NativeTypeName("const char *")] sbyte* str, [NativeTypeName("const char *const")] sbyte* passwd, [NativeTypeName("unsigned long long")] ulong passwdlen); [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int crypto_pwhash_argon2i_str_needs_rehash([NativeTypeName("const char [128]")] sbyte* str, [NativeTypeName("unsigned long long")] ulong opslimit, [NativeTypeName("size_t")] nuint memlimit); + public static extern int crypto_pwhash_argon2i_str_needs_rehash([NativeTypeName("const char *")] sbyte* str, [NativeTypeName("unsigned long long")] ulong opslimit, [NativeTypeName("size_t")] nuint memlimit); [NativeTypeName("#define crypto_pwhash_argon2i_ALG_ARGON2I13 1")] public const int crypto_pwhash_argon2i_ALG_ARGON2I13 = 1; @@ -1684,7 +1689,7 @@ namespace SpaceWizards.Sodium.Interop public const uint crypto_pwhash_argon2i_STRBYTES = 128U; [NativeTypeName("#define crypto_pwhash_argon2i_STRPREFIX \"$argon2i$\"")] - public static ReadOnlySpan crypto_pwhash_argon2i_STRPREFIX => new byte[] { 0x24, 0x61, 0x72, 0x67, 0x6F, 0x6E, 0x32, 0x69, 0x24, 0x00 }; + public static ReadOnlySpan crypto_pwhash_argon2i_STRPREFIX => "$argon2i$"u8; [NativeTypeName("#define crypto_pwhash_argon2i_OPSLIMIT_MIN 3U")] public const uint crypto_pwhash_argon2i_OPSLIMIT_MIN = 3U; @@ -1791,13 +1796,13 @@ namespace SpaceWizards.Sodium.Interop public static extern int crypto_pwhash_argon2id([NativeTypeName("unsigned char *const")] byte* @out, [NativeTypeName("unsigned long long")] ulong outlen, [NativeTypeName("const char *const")] sbyte* passwd, [NativeTypeName("unsigned long long")] ulong passwdlen, [NativeTypeName("const unsigned char *const")] byte* salt, [NativeTypeName("unsigned long long")] ulong opslimit, [NativeTypeName("size_t")] nuint memlimit, int alg); [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int crypto_pwhash_argon2id_str([NativeTypeName("char [128]")] sbyte* @out, [NativeTypeName("const char *const")] sbyte* passwd, [NativeTypeName("unsigned long long")] ulong passwdlen, [NativeTypeName("unsigned long long")] ulong opslimit, [NativeTypeName("size_t")] nuint memlimit); + public static extern int crypto_pwhash_argon2id_str([NativeTypeName("char[128]")] sbyte* @out, [NativeTypeName("const char *const")] sbyte* passwd, [NativeTypeName("unsigned long long")] ulong passwdlen, [NativeTypeName("unsigned long long")] ulong opslimit, [NativeTypeName("size_t")] nuint memlimit); [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int crypto_pwhash_argon2id_str_verify([NativeTypeName("const char [128]")] sbyte* str, [NativeTypeName("const char *const")] sbyte* passwd, [NativeTypeName("unsigned long long")] ulong passwdlen); + public static extern int crypto_pwhash_argon2id_str_verify([NativeTypeName("const char *")] sbyte* str, [NativeTypeName("const char *const")] sbyte* passwd, [NativeTypeName("unsigned long long")] ulong passwdlen); [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int crypto_pwhash_argon2id_str_needs_rehash([NativeTypeName("const char [128]")] sbyte* str, [NativeTypeName("unsigned long long")] ulong opslimit, [NativeTypeName("size_t")] nuint memlimit); + public static extern int crypto_pwhash_argon2id_str_needs_rehash([NativeTypeName("const char *")] sbyte* str, [NativeTypeName("unsigned long long")] ulong opslimit, [NativeTypeName("size_t")] nuint memlimit); [NativeTypeName("#define crypto_pwhash_argon2id_ALG_ARGON2ID13 2")] public const int crypto_pwhash_argon2id_ALG_ARGON2ID13 = 2; @@ -1821,7 +1826,7 @@ namespace SpaceWizards.Sodium.Interop public const uint crypto_pwhash_argon2id_STRBYTES = 128U; [NativeTypeName("#define crypto_pwhash_argon2id_STRPREFIX \"$argon2id$\"")] - public static ReadOnlySpan crypto_pwhash_argon2id_STRPREFIX => new byte[] { 0x24, 0x61, 0x72, 0x67, 0x6F, 0x6E, 0x32, 0x69, 0x64, 0x24, 0x00 }; + public static ReadOnlySpan crypto_pwhash_argon2id_STRPREFIX => "$argon2id$"u8; [NativeTypeName("#define crypto_pwhash_argon2id_OPSLIMIT_MIN 1U")] public const uint crypto_pwhash_argon2id_OPSLIMIT_MIN = 1U; @@ -1917,16 +1922,16 @@ namespace SpaceWizards.Sodium.Interop public static extern int crypto_pwhash_scryptsalsa208sha256([NativeTypeName("unsigned char *const")] byte* @out, [NativeTypeName("unsigned long long")] ulong outlen, [NativeTypeName("const char *const")] sbyte* passwd, [NativeTypeName("unsigned long long")] ulong passwdlen, [NativeTypeName("const unsigned char *const")] byte* salt, [NativeTypeName("unsigned long long")] ulong opslimit, [NativeTypeName("size_t")] nuint memlimit); [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int crypto_pwhash_scryptsalsa208sha256_str([NativeTypeName("char [102]")] sbyte* @out, [NativeTypeName("const char *const")] sbyte* passwd, [NativeTypeName("unsigned long long")] ulong passwdlen, [NativeTypeName("unsigned long long")] ulong opslimit, [NativeTypeName("size_t")] nuint memlimit); + public static extern int crypto_pwhash_scryptsalsa208sha256_str([NativeTypeName("char[102]")] sbyte* @out, [NativeTypeName("const char *const")] sbyte* passwd, [NativeTypeName("unsigned long long")] ulong passwdlen, [NativeTypeName("unsigned long long")] ulong opslimit, [NativeTypeName("size_t")] nuint memlimit); [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int crypto_pwhash_scryptsalsa208sha256_str_verify([NativeTypeName("const char [102]")] sbyte* str, [NativeTypeName("const char *const")] sbyte* passwd, [NativeTypeName("unsigned long long")] ulong passwdlen); + public static extern int crypto_pwhash_scryptsalsa208sha256_str_verify([NativeTypeName("const char *")] sbyte* str, [NativeTypeName("const char *const")] sbyte* passwd, [NativeTypeName("unsigned long long")] ulong passwdlen); [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] public static extern int crypto_pwhash_scryptsalsa208sha256_ll([NativeTypeName("const uint8_t *")] byte* passwd, [NativeTypeName("size_t")] nuint passwdlen, [NativeTypeName("const uint8_t *")] byte* salt, [NativeTypeName("size_t")] nuint saltlen, [NativeTypeName("uint64_t")] ulong N, [NativeTypeName("uint32_t")] uint r, [NativeTypeName("uint32_t")] uint p, [NativeTypeName("uint8_t *")] byte* buf, [NativeTypeName("size_t")] nuint buflen); [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int crypto_pwhash_scryptsalsa208sha256_str_needs_rehash([NativeTypeName("const char [102]")] sbyte* str, [NativeTypeName("unsigned long long")] ulong opslimit, [NativeTypeName("size_t")] nuint memlimit); + public static extern int crypto_pwhash_scryptsalsa208sha256_str_needs_rehash([NativeTypeName("const char *")] sbyte* str, [NativeTypeName("unsigned long long")] ulong opslimit, [NativeTypeName("size_t")] nuint memlimit); [NativeTypeName("#define crypto_pwhash_scryptsalsa208sha256_BYTES_MIN 16U")] public const uint crypto_pwhash_scryptsalsa208sha256_BYTES_MIN = 16U; @@ -1947,7 +1952,7 @@ namespace SpaceWizards.Sodium.Interop public const uint crypto_pwhash_scryptsalsa208sha256_STRBYTES = 102U; [NativeTypeName("#define crypto_pwhash_scryptsalsa208sha256_STRPREFIX \"$7$\"")] - public static ReadOnlySpan crypto_pwhash_scryptsalsa208sha256_STRPREFIX => new byte[] { 0x24, 0x37, 0x24, 0x00 }; + public static ReadOnlySpan crypto_pwhash_scryptsalsa208sha256_STRPREFIX => "$7$"u8; [NativeTypeName("#define crypto_pwhash_scryptsalsa208sha256_OPSLIMIT_MIN 32768U")] public const uint crypto_pwhash_scryptsalsa208sha256_OPSLIMIT_MIN = 32768U; @@ -1998,7 +2003,7 @@ namespace SpaceWizards.Sodium.Interop public const uint crypto_scalarmult_SCALARBYTES = 32U; [NativeTypeName("#define crypto_scalarmult_PRIMITIVE \"curve25519\"")] - public static ReadOnlySpan crypto_scalarmult_PRIMITIVE => new byte[] { 0x63, 0x75, 0x72, 0x76, 0x65, 0x32, 0x35, 0x35, 0x31, 0x39, 0x00 }; + public static ReadOnlySpan crypto_scalarmult_PRIMITIVE => "curve25519"u8; [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] [return: NativeTypeName("size_t")] @@ -2099,7 +2104,7 @@ namespace SpaceWizards.Sodium.Interop public static extern int crypto_secretbox_open_detached([NativeTypeName("unsigned char *")] byte* m, [NativeTypeName("const unsigned char *")] byte* c, [NativeTypeName("const unsigned char *")] byte* mac, [NativeTypeName("unsigned long long")] ulong clen, [NativeTypeName("const unsigned char *")] byte* n, [NativeTypeName("const unsigned char *")] byte* k); [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void crypto_secretbox_keygen([NativeTypeName("unsigned char [32]")] byte* k); + public static extern void crypto_secretbox_keygen([NativeTypeName("unsigned char[32]")] byte* k); [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] [return: NativeTypeName("size_t")] @@ -2125,7 +2130,7 @@ namespace SpaceWizards.Sodium.Interop public const uint crypto_secretbox_MACBYTES = 16U; [NativeTypeName("#define crypto_secretbox_PRIMITIVE \"xsalsa20poly1305\"")] - public static ReadOnlySpan crypto_secretbox_PRIMITIVE => new byte[] { 0x78, 0x73, 0x61, 0x6C, 0x73, 0x61, 0x32, 0x30, 0x70, 0x6F, 0x6C, 0x79, 0x31, 0x33, 0x30, 0x35, 0x00 }; + public static ReadOnlySpan crypto_secretbox_PRIMITIVE => "xsalsa20poly1305"u8; [NativeTypeName("#define crypto_secretbox_MESSAGEBYTES_MAX crypto_secretbox_xsalsa20poly1305_MESSAGEBYTES_MAX")] public const ulong crypto_secretbox_MESSAGEBYTES_MAX = (((0xffffffffffffffffUL) < (0xffffffffffffffffUL) ? (0xffffffffffffffffUL) : (0xffffffffffffffffUL)) - 16U); @@ -2199,7 +2204,7 @@ namespace SpaceWizards.Sodium.Interop public static extern int crypto_secretbox_xsalsa20poly1305_open([NativeTypeName("unsigned char *")] byte* m, [NativeTypeName("const unsigned char *")] byte* c, [NativeTypeName("unsigned long long")] ulong clen, [NativeTypeName("const unsigned char *")] byte* n, [NativeTypeName("const unsigned char *")] byte* k); [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void crypto_secretbox_xsalsa20poly1305_keygen([NativeTypeName("unsigned char [32]")] byte* k); + public static extern void crypto_secretbox_xsalsa20poly1305_keygen([NativeTypeName("unsigned char[32]")] byte* k); [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] [return: NativeTypeName("size_t")] @@ -2264,16 +2269,16 @@ namespace SpaceWizards.Sodium.Interop public static extern nuint crypto_secretstream_xchacha20poly1305_statebytes(); [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void crypto_secretstream_xchacha20poly1305_keygen([NativeTypeName("unsigned char [32]")] byte* k); + public static extern void crypto_secretstream_xchacha20poly1305_keygen([NativeTypeName("unsigned char[32]")] byte* k); [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int crypto_secretstream_xchacha20poly1305_init_push(crypto_secretstream_xchacha20poly1305_state* state, [NativeTypeName("unsigned char [24]")] byte* header, [NativeTypeName("const unsigned char [32]")] byte* k); + public static extern int crypto_secretstream_xchacha20poly1305_init_push(crypto_secretstream_xchacha20poly1305_state* state, [NativeTypeName("unsigned char[24]")] byte* header, [NativeTypeName("const unsigned char[32]")] byte* k); [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] public static extern int crypto_secretstream_xchacha20poly1305_push(crypto_secretstream_xchacha20poly1305_state* state, [NativeTypeName("unsigned char *")] byte* c, [NativeTypeName("unsigned long long *")] ulong* clen_p, [NativeTypeName("const unsigned char *")] byte* m, [NativeTypeName("unsigned long long")] ulong mlen, [NativeTypeName("const unsigned char *")] byte* ad, [NativeTypeName("unsigned long long")] ulong adlen, [NativeTypeName("unsigned char")] byte tag); [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int crypto_secretstream_xchacha20poly1305_init_pull(crypto_secretstream_xchacha20poly1305_state* state, [NativeTypeName("const unsigned char [24]")] byte* header, [NativeTypeName("const unsigned char [32]")] byte* k); + public static extern int crypto_secretstream_xchacha20poly1305_init_pull(crypto_secretstream_xchacha20poly1305_state* state, [NativeTypeName("const unsigned char[24]")] byte* header, [NativeTypeName("const unsigned char[32]")] byte* k); [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] public static extern int crypto_secretstream_xchacha20poly1305_pull(crypto_secretstream_xchacha20poly1305_state* state, [NativeTypeName("unsigned char *")] byte* m, [NativeTypeName("unsigned long long *")] ulong* mlen_p, [NativeTypeName("unsigned char *")] byte* tag_p, [NativeTypeName("const unsigned char *")] byte* c, [NativeTypeName("unsigned long long")] ulong clen, [NativeTypeName("const unsigned char *")] byte* ad, [NativeTypeName("unsigned long long")] ulong adlen); @@ -2321,7 +2326,7 @@ namespace SpaceWizards.Sodium.Interop public static extern int crypto_shorthash([NativeTypeName("unsigned char *")] byte* @out, [NativeTypeName("const unsigned char *")] byte* @in, [NativeTypeName("unsigned long long")] ulong inlen, [NativeTypeName("const unsigned char *")] byte* k); [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void crypto_shorthash_keygen([NativeTypeName("unsigned char [16]")] byte* k); + public static extern void crypto_shorthash_keygen([NativeTypeName("unsigned char[16]")] byte* k); [NativeTypeName("#define crypto_shorthash_BYTES crypto_shorthash_siphash24_BYTES")] public const uint crypto_shorthash_BYTES = 8U; @@ -2330,7 +2335,7 @@ namespace SpaceWizards.Sodium.Interop public const uint crypto_shorthash_KEYBYTES = 16U; [NativeTypeName("#define crypto_shorthash_PRIMITIVE \"siphash24\"")] - public static ReadOnlySpan crypto_shorthash_PRIMITIVE => new byte[] { 0x73, 0x69, 0x70, 0x68, 0x61, 0x73, 0x68, 0x32, 0x34, 0x00 }; + public static ReadOnlySpan crypto_shorthash_PRIMITIVE => "siphash24"u8; [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] [return: NativeTypeName("size_t")] @@ -2440,7 +2445,7 @@ namespace SpaceWizards.Sodium.Interop public const ulong crypto_sign_MESSAGEBYTES_MAX = (((0xffffffffffffffffUL) < (0xffffffffffffffffUL) ? (0xffffffffffffffffUL) : (0xffffffffffffffffUL)) - 64U); [NativeTypeName("#define crypto_sign_PRIMITIVE \"ed25519\"")] - public static ReadOnlySpan crypto_sign_PRIMITIVE => new byte[] { 0x65, 0x64, 0x32, 0x35, 0x35, 0x31, 0x39, 0x00 }; + public static ReadOnlySpan crypto_sign_PRIMITIVE => "ed25519"u8; [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] [return: NativeTypeName("size_t")] @@ -2524,12 +2529,15 @@ namespace SpaceWizards.Sodium.Interop public const ulong crypto_sign_ed25519_MESSAGEBYTES_MAX = (((0xffffffffffffffffUL) < (0xffffffffffffffffUL) ? (0xffffffffffffffffUL) : (0xffffffffffffffffUL)) - 64U); [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [Obsolete] public static extern int crypto_sign_edwards25519sha512batch([NativeTypeName("unsigned char *")] byte* sm, [NativeTypeName("unsigned long long *")] ulong* smlen_p, [NativeTypeName("const unsigned char *")] byte* m, [NativeTypeName("unsigned long long")] ulong mlen, [NativeTypeName("const unsigned char *")] byte* sk); [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [Obsolete] public static extern int crypto_sign_edwards25519sha512batch_open([NativeTypeName("unsigned char *")] byte* m, [NativeTypeName("unsigned long long *")] ulong* mlen_p, [NativeTypeName("const unsigned char *")] byte* sm, [NativeTypeName("unsigned long long")] ulong smlen, [NativeTypeName("const unsigned char *")] byte* pk); [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [Obsolete] public static extern int crypto_sign_edwards25519sha512batch_keypair([NativeTypeName("unsigned char *")] byte* pk, [NativeTypeName("unsigned char *")] byte* sk); [NativeTypeName("#define crypto_sign_edwards25519sha512batch_BYTES 64U")] @@ -2567,7 +2575,7 @@ namespace SpaceWizards.Sodium.Interop public static extern int crypto_stream_xor([NativeTypeName("unsigned char *")] byte* c, [NativeTypeName("const unsigned char *")] byte* m, [NativeTypeName("unsigned long long")] ulong mlen, [NativeTypeName("const unsigned char *")] byte* n, [NativeTypeName("const unsigned char *")] byte* k); [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void crypto_stream_keygen([NativeTypeName("unsigned char [32]")] byte* k); + public static extern void crypto_stream_keygen([NativeTypeName("unsigned char[32]")] byte* k); [NativeTypeName("#define crypto_stream_KEYBYTES crypto_stream_xsalsa20_KEYBYTES")] public const uint crypto_stream_KEYBYTES = 32U; @@ -2579,7 +2587,7 @@ namespace SpaceWizards.Sodium.Interop public const ulong crypto_stream_MESSAGEBYTES_MAX = ((0xffffffffffffffffUL) < (0xffffffffffffffffUL) ? (0xffffffffffffffffUL) : (0xffffffffffffffffUL)); [NativeTypeName("#define crypto_stream_PRIMITIVE \"xsalsa20\"")] - public static ReadOnlySpan crypto_stream_PRIMITIVE => new byte[] { 0x78, 0x73, 0x61, 0x6C, 0x73, 0x61, 0x32, 0x30, 0x00 }; + public static ReadOnlySpan crypto_stream_PRIMITIVE => "xsalsa20"u8; [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] [return: NativeTypeName("size_t")] @@ -2603,7 +2611,7 @@ namespace SpaceWizards.Sodium.Interop public static extern int crypto_stream_chacha20_xor_ic([NativeTypeName("unsigned char *")] byte* c, [NativeTypeName("const unsigned char *")] byte* m, [NativeTypeName("unsigned long long")] ulong mlen, [NativeTypeName("const unsigned char *")] byte* n, [NativeTypeName("uint64_t")] ulong ic, [NativeTypeName("const unsigned char *")] byte* k); [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void crypto_stream_chacha20_keygen([NativeTypeName("unsigned char [32]")] byte* k); + public static extern void crypto_stream_chacha20_keygen([NativeTypeName("unsigned char[32]")] byte* k); [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] [return: NativeTypeName("size_t")] @@ -2627,7 +2635,7 @@ namespace SpaceWizards.Sodium.Interop public static extern int crypto_stream_chacha20_ietf_xor_ic([NativeTypeName("unsigned char *")] byte* c, [NativeTypeName("const unsigned char *")] byte* m, [NativeTypeName("unsigned long long")] ulong mlen, [NativeTypeName("const unsigned char *")] byte* n, [NativeTypeName("uint32_t")] uint ic, [NativeTypeName("const unsigned char *")] byte* k); [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void crypto_stream_chacha20_ietf_keygen([NativeTypeName("unsigned char [32]")] byte* k); + public static extern void crypto_stream_chacha20_ietf_keygen([NativeTypeName("unsigned char[32]")] byte* k); [NativeTypeName("#define crypto_stream_chacha20_KEYBYTES 32U")] public const uint crypto_stream_chacha20_KEYBYTES = 32U; @@ -2678,7 +2686,7 @@ namespace SpaceWizards.Sodium.Interop public static extern int crypto_stream_salsa20_xor_ic([NativeTypeName("unsigned char *")] byte* c, [NativeTypeName("const unsigned char *")] byte* m, [NativeTypeName("unsigned long long")] ulong mlen, [NativeTypeName("const unsigned char *")] byte* n, [NativeTypeName("uint64_t")] ulong ic, [NativeTypeName("const unsigned char *")] byte* k); [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void crypto_stream_salsa20_keygen([NativeTypeName("unsigned char [32]")] byte* k); + public static extern void crypto_stream_salsa20_keygen([NativeTypeName("unsigned char[32]")] byte* k); [NativeTypeName("#define crypto_stream_salsa20_KEYBYTES 32U")] public const uint crypto_stream_salsa20_KEYBYTES = 32U; @@ -2691,24 +2699,30 @@ namespace SpaceWizards.Sodium.Interop [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] [return: NativeTypeName("size_t")] + [Obsolete] public static extern nuint crypto_stream_salsa208_keybytes(); [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] [return: NativeTypeName("size_t")] + [Obsolete] public static extern nuint crypto_stream_salsa208_noncebytes(); [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] [return: NativeTypeName("size_t")] + [Obsolete] public static extern nuint crypto_stream_salsa208_messagebytes_max(); [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [Obsolete] public static extern int crypto_stream_salsa208([NativeTypeName("unsigned char *")] byte* c, [NativeTypeName("unsigned long long")] ulong clen, [NativeTypeName("const unsigned char *")] byte* n, [NativeTypeName("const unsigned char *")] byte* k); [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [Obsolete] public static extern int crypto_stream_salsa208_xor([NativeTypeName("unsigned char *")] byte* c, [NativeTypeName("const unsigned char *")] byte* m, [NativeTypeName("unsigned long long")] ulong mlen, [NativeTypeName("const unsigned char *")] byte* n, [NativeTypeName("const unsigned char *")] byte* k); [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void crypto_stream_salsa208_keygen([NativeTypeName("unsigned char [32]")] byte* k); + [Obsolete] + public static extern void crypto_stream_salsa208_keygen([NativeTypeName("unsigned char[32]")] byte* k); [NativeTypeName("#define crypto_stream_salsa208_KEYBYTES 32U")] public const uint crypto_stream_salsa208_KEYBYTES = 32U; @@ -2738,7 +2752,7 @@ namespace SpaceWizards.Sodium.Interop public static extern int crypto_stream_salsa2012_xor([NativeTypeName("unsigned char *")] byte* c, [NativeTypeName("const unsigned char *")] byte* m, [NativeTypeName("unsigned long long")] ulong mlen, [NativeTypeName("const unsigned char *")] byte* n, [NativeTypeName("const unsigned char *")] byte* k); [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void crypto_stream_salsa2012_keygen([NativeTypeName("unsigned char [32]")] byte* k); + public static extern void crypto_stream_salsa2012_keygen([NativeTypeName("unsigned char[32]")] byte* k); [NativeTypeName("#define crypto_stream_salsa2012_KEYBYTES 32U")] public const uint crypto_stream_salsa2012_KEYBYTES = 32U; @@ -2771,7 +2785,7 @@ namespace SpaceWizards.Sodium.Interop public static extern int crypto_stream_xchacha20_xor_ic([NativeTypeName("unsigned char *")] byte* c, [NativeTypeName("const unsigned char *")] byte* m, [NativeTypeName("unsigned long long")] ulong mlen, [NativeTypeName("const unsigned char *")] byte* n, [NativeTypeName("uint64_t")] ulong ic, [NativeTypeName("const unsigned char *")] byte* k); [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void crypto_stream_xchacha20_keygen([NativeTypeName("unsigned char [32]")] byte* k); + public static extern void crypto_stream_xchacha20_keygen([NativeTypeName("unsigned char[32]")] byte* k); [NativeTypeName("#define crypto_stream_xchacha20_KEYBYTES 32U")] public const uint crypto_stream_xchacha20_KEYBYTES = 32U; @@ -2804,7 +2818,7 @@ namespace SpaceWizards.Sodium.Interop public static extern int crypto_stream_xsalsa20_xor_ic([NativeTypeName("unsigned char *")] byte* c, [NativeTypeName("const unsigned char *")] byte* m, [NativeTypeName("unsigned long long")] ulong mlen, [NativeTypeName("const unsigned char *")] byte* n, [NativeTypeName("uint64_t")] ulong ic, [NativeTypeName("const unsigned char *")] byte* k); [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void crypto_stream_xsalsa20_keygen([NativeTypeName("unsigned char [32]")] byte* k); + public static extern void crypto_stream_xsalsa20_keygen([NativeTypeName("unsigned char[32]")] byte* k); [NativeTypeName("#define crypto_stream_xsalsa20_KEYBYTES 32U")] public const uint crypto_stream_xsalsa20_KEYBYTES = 32U; @@ -2856,7 +2870,7 @@ namespace SpaceWizards.Sodium.Interop public static extern void randombytes_buf([NativeTypeName("void *const")] void* buf, [NativeTypeName("const size_t")] nuint size); [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern void randombytes_buf_deterministic([NativeTypeName("void *const")] void* buf, [NativeTypeName("const size_t")] nuint size, [NativeTypeName("const unsigned char [32]")] byte* seed); + public static extern void randombytes_buf_deterministic([NativeTypeName("void *const")] void* buf, [NativeTypeName("const size_t")] nuint size, [NativeTypeName("const unsigned char[32]")] byte* seed); [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] [return: NativeTypeName("uint32_t")] @@ -2873,7 +2887,7 @@ namespace SpaceWizards.Sodium.Interop public static extern int randombytes_close(); [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int randombytes_set_implementation(randombytes_implementation* impl); + public static extern int randombytes_set_implementation([NativeTypeName("const randombytes_implementation *")] randombytes_implementation* impl); [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] [return: NativeTypeName("const char *")] @@ -2891,6 +2905,9 @@ namespace SpaceWizards.Sodium.Interop [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] public static extern int sodium_runtime_has_neon(); + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int sodium_runtime_has_armcrypto(); + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] public static extern int sodium_runtime_has_sse2(); @@ -2953,7 +2970,7 @@ namespace SpaceWizards.Sodium.Interop public static extern sbyte* sodium_bin2hex([NativeTypeName("char *const")] sbyte* hex, [NativeTypeName("const size_t")] nuint hex_maxlen, [NativeTypeName("const unsigned char *const")] byte* bin, [NativeTypeName("const size_t")] nuint bin_len); [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int sodium_hex2bin([NativeTypeName("unsigned char *const")] byte* bin, [NativeTypeName("const size_t")] nuint bin_maxlen, [NativeTypeName("const char *const")] sbyte* hex, [NativeTypeName("const size_t")] nuint hex_len, [NativeTypeName("const char *const")] sbyte* ignore, [NativeTypeName("size_t *const")] nuint* bin_len, [NativeTypeName("const char **const")] sbyte** hex_end); + public static extern int sodium_hex2bin([NativeTypeName("unsigned char *const")] byte* bin, [NativeTypeName("const size_t")] nuint bin_maxlen, [NativeTypeName("const char *const")] sbyte* hex, [NativeTypeName("const size_t")] nuint hex_len, [NativeTypeName("const char *const")] sbyte* ignore, [NativeTypeName("size_t *")] nuint* bin_len, [NativeTypeName("const char **const")] sbyte** hex_end); [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] [return: NativeTypeName("size_t")] @@ -2964,7 +2981,7 @@ namespace SpaceWizards.Sodium.Interop public static extern sbyte* sodium_bin2base64([NativeTypeName("char *const")] sbyte* b64, [NativeTypeName("const size_t")] nuint b64_maxlen, [NativeTypeName("const unsigned char *const")] byte* bin, [NativeTypeName("const size_t")] nuint bin_len, [NativeTypeName("const int")] int variant); [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] - public static extern int sodium_base642bin([NativeTypeName("unsigned char *const")] byte* bin, [NativeTypeName("const size_t")] nuint bin_maxlen, [NativeTypeName("const char *const")] sbyte* b64, [NativeTypeName("const size_t")] nuint b64_len, [NativeTypeName("const char *const")] sbyte* ignore, [NativeTypeName("size_t *const")] nuint* bin_len, [NativeTypeName("const char **const")] sbyte** b64_end, [NativeTypeName("const int")] int variant); + public static extern int sodium_base642bin([NativeTypeName("unsigned char *const")] byte* bin, [NativeTypeName("const size_t")] nuint bin_maxlen, [NativeTypeName("const char *const")] sbyte* b64, [NativeTypeName("const size_t")] nuint b64_len, [NativeTypeName("const char *const")] sbyte* ignore, [NativeTypeName("size_t *")] nuint* bin_len, [NativeTypeName("const char **const")] sbyte** b64_end, [NativeTypeName("const int")] int variant); [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] public static extern int sodium_mlock([NativeTypeName("void *const")] void* addr, [NativeTypeName("const size_t")] nuint len); @@ -3024,13 +3041,13 @@ namespace SpaceWizards.Sodium.Interop [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] public static extern int sodium_library_minimal(); - [NativeTypeName("#define SODIUM_VERSION_STRING \"1.0.18\"")] - public static ReadOnlySpan SODIUM_VERSION_STRING => new byte[] { 0x31, 0x2E, 0x30, 0x2E, 0x31, 0x38, 0x00 }; + [NativeTypeName("#define SODIUM_VERSION_STRING \"1.0.20\"")] + public static ReadOnlySpan SODIUM_VERSION_STRING => "1.0.20"u8; - [NativeTypeName("#define SODIUM_LIBRARY_VERSION_MAJOR 10")] - public const int SODIUM_LIBRARY_VERSION_MAJOR = 10; + [NativeTypeName("#define SODIUM_LIBRARY_VERSION_MAJOR 26")] + public const int SODIUM_LIBRARY_VERSION_MAJOR = 26; - [NativeTypeName("#define SODIUM_LIBRARY_VERSION_MINOR 3")] - public const int SODIUM_LIBRARY_VERSION_MINOR = 3; + [NativeTypeName("#define SODIUM_LIBRARY_VERSION_MINOR 2")] + public const int SODIUM_LIBRARY_VERSION_MINOR = 2; } } diff --git a/CSSUDII.Sodium.Interop/Generated/NativeAnnotationAttribute.cs b/CSSUDII.Sodium.Interop/Generated/NativeAnnotationAttribute.cs new file mode 100644 index 0000000..23b2db8 --- /dev/null +++ b/CSSUDII.Sodium.Interop/Generated/NativeAnnotationAttribute.cs @@ -0,0 +1,23 @@ +using System; +using System.Diagnostics; + +namespace CSSUDII.Sodium.Interop +{ + /// Defines the annotation found in a native declaration. + [AttributeUsage(AttributeTargets.Struct | AttributeTargets.Enum | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter | AttributeTargets.ReturnValue, AllowMultiple = true, Inherited = false)] + [Conditional("DEBUG")] + internal sealed partial class NativeAnnotationAttribute : Attribute + { + private readonly string _annotation; + + /// Initializes a new instance of the class. + /// The annotation that was used in the native declaration. + public NativeAnnotationAttribute(string annotation) + { + _annotation = annotation; + } + + /// Gets the annotation that was used in the native declaration. + public string Annotation => _annotation; + } +} diff --git a/SpaceWizards.Sodium.Interop/Generated/NativeTypeNameAttribute.cs b/CSSUDII.Sodium.Interop/Generated/NativeTypeNameAttribute.cs similarity index 96% rename from SpaceWizards.Sodium.Interop/Generated/NativeTypeNameAttribute.cs rename to CSSUDII.Sodium.Interop/Generated/NativeTypeNameAttribute.cs index 1958d79..966cece 100644 --- a/SpaceWizards.Sodium.Interop/Generated/NativeTypeNameAttribute.cs +++ b/CSSUDII.Sodium.Interop/Generated/NativeTypeNameAttribute.cs @@ -1,7 +1,7 @@ using System; using System.Diagnostics; -namespace SpaceWizards.Sodium.Interop +namespace CSSUDII.Sodium.Interop { /// Defines the type of a member as it was used in the native signature. [AttributeUsage(AttributeTargets.Struct | AttributeTargets.Enum | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter | AttributeTargets.ReturnValue, AllowMultiple = false, Inherited = true)] diff --git a/CSSUDII.Sodium.Interop/Generated/crypto_aead_aes256gcm_state.cs b/CSSUDII.Sodium.Interop/Generated/crypto_aead_aes256gcm_state.cs new file mode 100644 index 0000000..ab01057 --- /dev/null +++ b/CSSUDII.Sodium.Interop/Generated/crypto_aead_aes256gcm_state.cs @@ -0,0 +1,16 @@ +using System.Runtime.CompilerServices; + +namespace CSSUDII.Sodium.Interop +{ + public partial struct crypto_aead_aes256gcm_state + { + [NativeTypeName("unsigned char[512]")] + public _opaque_e__FixedBuffer opaque; + + [InlineArray(512)] + public partial struct _opaque_e__FixedBuffer + { + public byte e0; + } + } +} diff --git a/SpaceWizards.Sodium.Interop/Generated/crypto_auth_hmacsha256_state.cs b/CSSUDII.Sodium.Interop/Generated/crypto_auth_hmacsha256_state.cs similarity index 81% rename from SpaceWizards.Sodium.Interop/Generated/crypto_auth_hmacsha256_state.cs rename to CSSUDII.Sodium.Interop/Generated/crypto_auth_hmacsha256_state.cs index e5f0858..20c93e5 100644 --- a/SpaceWizards.Sodium.Interop/Generated/crypto_auth_hmacsha256_state.cs +++ b/CSSUDII.Sodium.Interop/Generated/crypto_auth_hmacsha256_state.cs @@ -1,4 +1,4 @@ -namespace SpaceWizards.Sodium.Interop +namespace CSSUDII.Sodium.Interop { public partial struct crypto_auth_hmacsha256_state { diff --git a/SpaceWizards.Sodium.Interop/Generated/crypto_auth_hmacsha512256_state.cs b/CSSUDII.Sodium.Interop/Generated/crypto_auth_hmacsha512256_state.cs similarity index 81% rename from SpaceWizards.Sodium.Interop/Generated/crypto_auth_hmacsha512256_state.cs rename to CSSUDII.Sodium.Interop/Generated/crypto_auth_hmacsha512256_state.cs index 0edd860..dd99c73 100644 --- a/SpaceWizards.Sodium.Interop/Generated/crypto_auth_hmacsha512256_state.cs +++ b/CSSUDII.Sodium.Interop/Generated/crypto_auth_hmacsha512256_state.cs @@ -1,4 +1,4 @@ -namespace SpaceWizards.Sodium.Interop +namespace CSSUDII.Sodium.Interop { public partial struct crypto_auth_hmacsha512256_state { diff --git a/CSSUDII.Sodium.Interop/Generated/crypto_generichash_blake2b_state.cs b/CSSUDII.Sodium.Interop/Generated/crypto_generichash_blake2b_state.cs new file mode 100644 index 0000000..3f0f38d --- /dev/null +++ b/CSSUDII.Sodium.Interop/Generated/crypto_generichash_blake2b_state.cs @@ -0,0 +1,16 @@ +using System.Runtime.CompilerServices; + +namespace CSSUDII.Sodium.Interop +{ + public partial struct crypto_generichash_blake2b_state + { + [NativeTypeName("unsigned char[384]")] + public _opaque_e__FixedBuffer opaque; + + [InlineArray(384)] + public partial struct _opaque_e__FixedBuffer + { + public byte e0; + } + } +} diff --git a/CSSUDII.Sodium.Interop/Generated/crypto_hash_sha256_state.cs b/CSSUDII.Sodium.Interop/Generated/crypto_hash_sha256_state.cs new file mode 100644 index 0000000..c07bbab --- /dev/null +++ b/CSSUDII.Sodium.Interop/Generated/crypto_hash_sha256_state.cs @@ -0,0 +1,28 @@ +using System.Runtime.CompilerServices; + +namespace CSSUDII.Sodium.Interop +{ + public partial struct crypto_hash_sha256_state + { + [NativeTypeName("uint32_t[8]")] + public _state_e__FixedBuffer state; + + [NativeTypeName("uint64_t")] + public ulong count; + + [NativeTypeName("uint8_t[64]")] + public _buf_e__FixedBuffer buf; + + [InlineArray(8)] + public partial struct _state_e__FixedBuffer + { + public uint e0; + } + + [InlineArray(64)] + public partial struct _buf_e__FixedBuffer + { + public byte e0; + } + } +} diff --git a/CSSUDII.Sodium.Interop/Generated/crypto_hash_sha512_state.cs b/CSSUDII.Sodium.Interop/Generated/crypto_hash_sha512_state.cs new file mode 100644 index 0000000..c0e3e76 --- /dev/null +++ b/CSSUDII.Sodium.Interop/Generated/crypto_hash_sha512_state.cs @@ -0,0 +1,34 @@ +using System.Runtime.CompilerServices; + +namespace CSSUDII.Sodium.Interop +{ + public partial struct crypto_hash_sha512_state + { + [NativeTypeName("uint64_t[8]")] + public _state_e__FixedBuffer state; + + [NativeTypeName("uint64_t[2]")] + public _count_e__FixedBuffer count; + + [NativeTypeName("uint8_t[128]")] + public _buf_e__FixedBuffer buf; + + [InlineArray(8)] + public partial struct _state_e__FixedBuffer + { + public ulong e0; + } + + [InlineArray(2)] + public partial struct _count_e__FixedBuffer + { + public ulong e0; + } + + [InlineArray(128)] + public partial struct _buf_e__FixedBuffer + { + public byte e0; + } + } +} diff --git a/CSSUDII.Sodium.Interop/Generated/crypto_onetimeauth_poly1305_state.cs b/CSSUDII.Sodium.Interop/Generated/crypto_onetimeauth_poly1305_state.cs new file mode 100644 index 0000000..ecfdf7f --- /dev/null +++ b/CSSUDII.Sodium.Interop/Generated/crypto_onetimeauth_poly1305_state.cs @@ -0,0 +1,16 @@ +using System.Runtime.CompilerServices; + +namespace CSSUDII.Sodium.Interop +{ + public partial struct crypto_onetimeauth_poly1305_state + { + [NativeTypeName("unsigned char[256]")] + public _opaque_e__FixedBuffer opaque; + + [InlineArray(256)] + public partial struct _opaque_e__FixedBuffer + { + public byte e0; + } + } +} diff --git a/CSSUDII.Sodium.Interop/Generated/crypto_secretstream_xchacha20poly1305_state.cs b/CSSUDII.Sodium.Interop/Generated/crypto_secretstream_xchacha20poly1305_state.cs new file mode 100644 index 0000000..98d1cb9 --- /dev/null +++ b/CSSUDII.Sodium.Interop/Generated/crypto_secretstream_xchacha20poly1305_state.cs @@ -0,0 +1,34 @@ +using System.Runtime.CompilerServices; + +namespace CSSUDII.Sodium.Interop +{ + public partial struct crypto_secretstream_xchacha20poly1305_state + { + [NativeTypeName("unsigned char[32]")] + public _k_e__FixedBuffer k; + + [NativeTypeName("unsigned char[12]")] + public _nonce_e__FixedBuffer nonce; + + [NativeTypeName("unsigned char[8]")] + public __pad_e__FixedBuffer _pad; + + [InlineArray(32)] + public partial struct _k_e__FixedBuffer + { + public byte e0; + } + + [InlineArray(12)] + public partial struct _nonce_e__FixedBuffer + { + public byte e0; + } + + [InlineArray(8)] + public partial struct __pad_e__FixedBuffer + { + public byte e0; + } + } +} diff --git a/SpaceWizards.Sodium.Interop/Generated/crypto_sign_ed25519ph_state.cs b/CSSUDII.Sodium.Interop/Generated/crypto_sign_ed25519ph_state.cs similarity index 75% rename from SpaceWizards.Sodium.Interop/Generated/crypto_sign_ed25519ph_state.cs rename to CSSUDII.Sodium.Interop/Generated/crypto_sign_ed25519ph_state.cs index 13aad68..fb0faba 100644 --- a/SpaceWizards.Sodium.Interop/Generated/crypto_sign_ed25519ph_state.cs +++ b/CSSUDII.Sodium.Interop/Generated/crypto_sign_ed25519ph_state.cs @@ -1,4 +1,4 @@ -namespace SpaceWizards.Sodium.Interop +namespace CSSUDII.Sodium.Interop { public partial struct crypto_sign_ed25519ph_state { diff --git a/SpaceWizards.Sodium.Interop/Generated/randombytes_implementation.cs b/CSSUDII.Sodium.Interop/Generated/randombytes_implementation.cs similarity index 95% rename from SpaceWizards.Sodium.Interop/Generated/randombytes_implementation.cs rename to CSSUDII.Sodium.Interop/Generated/randombytes_implementation.cs index 0b24bcb..ef14fda 100644 --- a/SpaceWizards.Sodium.Interop/Generated/randombytes_implementation.cs +++ b/CSSUDII.Sodium.Interop/Generated/randombytes_implementation.cs @@ -1,4 +1,4 @@ -namespace SpaceWizards.Sodium.Interop +namespace CSSUDII.Sodium.Interop { public unsafe partial struct randombytes_implementation { diff --git a/SpaceWizards.Sodium.Interop/Libsodium.Manual.cs b/CSSUDII.Sodium.Interop/Libsodium.Manual.cs similarity index 90% rename from SpaceWizards.Sodium.Interop/Libsodium.Manual.cs rename to CSSUDII.Sodium.Interop/Libsodium.Manual.cs index 2665c64..513008a 100644 --- a/SpaceWizards.Sodium.Interop/Libsodium.Manual.cs +++ b/CSSUDII.Sodium.Interop/Libsodium.Manual.cs @@ -1,4 +1,4 @@ -namespace SpaceWizards.Sodium.Interop; +namespace CSSUDII.Sodium.Interop; public partial class Libsodium { diff --git a/SpaceWizards.Sodium.Tests/SpaceWizards.Sodium.Tests.csproj b/CSSUDII.Sodium.Tests/CSSUDII.Sodium.Tests.csproj similarity index 75% rename from SpaceWizards.Sodium.Tests/SpaceWizards.Sodium.Tests.csproj rename to CSSUDII.Sodium.Tests/CSSUDII.Sodium.Tests.csproj index d039a0c..f63c844 100644 --- a/SpaceWizards.Sodium.Tests/SpaceWizards.Sodium.Tests.csproj +++ b/CSSUDII.Sodium.Tests/CSSUDII.Sodium.Tests.csproj @@ -1,7 +1,7 @@ - net6.0 + net8.0 enable false true @@ -18,8 +18,8 @@ - - + + diff --git a/SpaceWizards.Sodium.Tests/GenericHashBlake2BTest.cs b/CSSUDII.Sodium.Tests/GenericHashBlake2BTest.cs similarity index 96% rename from SpaceWizards.Sodium.Tests/GenericHashBlake2BTest.cs rename to CSSUDII.Sodium.Tests/GenericHashBlake2BTest.cs index 07eff1b..c5f5fd0 100644 --- a/SpaceWizards.Sodium.Tests/GenericHashBlake2BTest.cs +++ b/CSSUDII.Sodium.Tests/GenericHashBlake2BTest.cs @@ -2,7 +2,7 @@ using System.Text; using NUnit.Framework; -namespace SpaceWizards.Sodium.Tests; +namespace CSSUDII.Sodium.Tests; [TestFixture] [TestOf(typeof(CryptoGenericHashBlake2B))] @@ -65,7 +65,7 @@ public sealed class GenericHashBlake2BTest var expected = Convert.FromHexString(expectedHex); var output = new byte[expected.Length]; - CryptoGenericHashBlake2B.State state; + CryptoGenericHashBlake2B.State state = new CryptoGenericHashBlake2B.State(); CryptoGenericHashBlake2B.Init(ref state, key, expected.Length); CryptoGenericHashBlake2B.Update(ref state, input); CryptoGenericHashBlake2B.Final(ref state, output); @@ -97,7 +97,7 @@ public sealed class GenericHashBlake2BTest var expected = Convert.FromHexString(expectedHex); var output = new byte[expected.Length]; - CryptoGenericHashBlake2B.State state; + CryptoGenericHashBlake2B.State state = new CryptoGenericHashBlake2B.State(); CryptoGenericHashBlake2B.InitSaltPersonal(ref state, key, expected.Length, salt, personal); CryptoGenericHashBlake2B.Update(ref state, input); CryptoGenericHashBlake2B.Final(ref state, output); diff --git a/SpaceWizards.Sodium.Tests/HelpersTest.cs b/CSSUDII.Sodium.Tests/HelpersTest.cs similarity index 99% rename from SpaceWizards.Sodium.Tests/HelpersTest.cs rename to CSSUDII.Sodium.Tests/HelpersTest.cs index 065e836..f1d8ba1 100644 --- a/SpaceWizards.Sodium.Tests/HelpersTest.cs +++ b/CSSUDII.Sodium.Tests/HelpersTest.cs @@ -2,7 +2,7 @@ using System.Text; using NUnit.Framework; -namespace SpaceWizards.Sodium.Tests; +namespace CSSUDII.Sodium.Tests; [TestFixture] [Parallelizable(ParallelScope.All)] diff --git a/SpaceWizards.Sodium.Tests/SecretBoxTest.cs b/CSSUDII.Sodium.Tests/SecretBoxTest.cs similarity index 92% rename from SpaceWizards.Sodium.Tests/SecretBoxTest.cs rename to CSSUDII.Sodium.Tests/SecretBoxTest.cs index 58e1cf8..05123c9 100644 --- a/SpaceWizards.Sodium.Tests/SecretBoxTest.cs +++ b/CSSUDII.Sodium.Tests/SecretBoxTest.cs @@ -1,8 +1,8 @@ using System.Security.Cryptography; using NUnit.Framework; -using static SpaceWizards.Sodium.Interop.Libsodium; +using static CSSUDII.Sodium.Interop.Libsodium; -namespace SpaceWizards.Sodium.Tests; +namespace CSSUDII.Sodium.Tests; [TestFixture] public sealed class SecretBoxTest diff --git a/SpaceWizards.Sodium.sln b/CSSUDII.Sodium.sln similarity index 80% rename from SpaceWizards.Sodium.sln rename to CSSUDII.Sodium.sln index ff94080..1d25b8d 100644 --- a/SpaceWizards.Sodium.sln +++ b/CSSUDII.Sodium.sln @@ -3,7 +3,7 @@ Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio Version 16 VisualStudioVersion = 16.0.30114.105 MinimumVisualStudioVersion = 10.0.40219.1 -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SpaceWizards.Sodium", "SpaceWizards.Sodium\SpaceWizards.Sodium.csproj", "{52EC2D2E-B57B-45E3-944A-247C750731C0}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CSSUDII.Sodium", "CSSUDII.Sodium\CSSUDII.Sodium.csproj", "{52EC2D2E-B57B-45E3-944A-247C750731C0}" EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Files", "Solution Files", "{40BDE6AC-8B1C-4E85-960E-B3D9EA0FEC6C}" ProjectSection(SolutionItems) = preProject @@ -14,14 +14,14 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Files", "Solution Directory.build.props = Directory.build.props EndProjectSection EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SpaceWizards.Sodium.Interop", "SpaceWizards.Sodium.Interop\SpaceWizards.Sodium.Interop.csproj", "{4565084B-3F40-44EA-B0B8-75DBFB9398EB}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CSSUDII.Sodium.Interop", "CSSUDII.Sodium.Interop\CSSUDII.Sodium.Interop.csproj", "{4565084B-3F40-44EA-B0B8-75DBFB9398EB}" EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Scripts", "Scripts", "{7F6778F9-368B-4F4E-BC12-88AA25F85329}" ProjectSection(SolutionItems) = preProject Scripts\GenBindings.rsp = Scripts\GenBindings.rsp EndProjectSection EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SpaceWizards.Sodium.Tests", "SpaceWizards.Sodium.Tests\SpaceWizards.Sodium.Tests.csproj", "{5E1C1FFF-6F86-4D33-9038-CF314CF1320B}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CSSUDII.Sodium.Tests", "CSSUDII.Sodium.Tests\CSSUDII.Sodium.Tests.csproj", "{5E1C1FFF-6F86-4D33-9038-CF314CF1320B}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution diff --git a/SpaceWizards.Sodium/SpaceWizards.Sodium.csproj b/CSSUDII.Sodium/CSSUDII.Sodium.csproj similarity index 70% rename from SpaceWizards.Sodium/SpaceWizards.Sodium.csproj rename to CSSUDII.Sodium/CSSUDII.Sodium.csproj index 26d270f..8c6cb15 100644 --- a/SpaceWizards.Sodium/SpaceWizards.Sodium.csproj +++ b/CSSUDII.Sodium/CSSUDII.Sodium.csproj @@ -1,11 +1,11 @@ - net6.0 + net8.0 enable enable true - SpaceWizards.Sodium + CSSUDII.Sodium 0.2.1 true Simple API binding for libsodium. @@ -14,7 +14,7 @@ - + diff --git a/SpaceWizards.Sodium/CryptoAeadXChaCha20Poly1305Ietf.cs b/CSSUDII.Sodium/CryptoAeadXChaCha20Poly1305Ietf.cs similarity index 99% rename from SpaceWizards.Sodium/CryptoAeadXChaCha20Poly1305Ietf.cs rename to CSSUDII.Sodium/CryptoAeadXChaCha20Poly1305Ietf.cs index 5aa3718..1f125f0 100644 --- a/SpaceWizards.Sodium/CryptoAeadXChaCha20Poly1305Ietf.cs +++ b/CSSUDII.Sodium/CryptoAeadXChaCha20Poly1305Ietf.cs @@ -1,4 +1,4 @@ -namespace SpaceWizards.Sodium; +namespace CSSUDII.Sodium; using static Interop.Libsodium; /// diff --git a/SpaceWizards.Sodium/CryptoBox.cs b/CSSUDII.Sodium/CryptoBox.cs similarity index 98% rename from SpaceWizards.Sodium/CryptoBox.cs rename to CSSUDII.Sodium/CryptoBox.cs index 5a39183..80197f1 100644 --- a/SpaceWizards.Sodium/CryptoBox.cs +++ b/CSSUDII.Sodium/CryptoBox.cs @@ -1,4 +1,4 @@ -namespace SpaceWizards.Sodium; +namespace CSSUDII.Sodium; using static Interop.Libsodium; diff --git a/SpaceWizards.Sodium/CryptoGenericHashBlake2B.cs b/CSSUDII.Sodium/CryptoGenericHashBlake2B.cs similarity index 98% rename from SpaceWizards.Sodium/CryptoGenericHashBlake2B.cs rename to CSSUDII.Sodium/CryptoGenericHashBlake2B.cs index 918e053..708e3fc 100644 --- a/SpaceWizards.Sodium/CryptoGenericHashBlake2B.cs +++ b/CSSUDII.Sodium/CryptoGenericHashBlake2B.cs @@ -1,6 +1,6 @@ -using SpaceWizards.Sodium.Interop; +using CSSUDII.Sodium.Interop; -namespace SpaceWizards.Sodium; +namespace CSSUDII.Sodium; using static Interop.Libsodium; diff --git a/SpaceWizards.Sodium/SodiumCore.cs b/CSSUDII.Sodium/SodiumCore.cs similarity index 89% rename from SpaceWizards.Sodium/SodiumCore.cs rename to CSSUDII.Sodium/SodiumCore.cs index d08440e..33d6167 100644 --- a/SpaceWizards.Sodium/SodiumCore.cs +++ b/CSSUDII.Sodium/SodiumCore.cs @@ -1,6 +1,6 @@ -using static SpaceWizards.Sodium.Interop.Libsodium; +using static CSSUDII.Sodium.Interop.Libsodium; -namespace SpaceWizards.Sodium; +namespace CSSUDII.Sodium; public static class SodiumCore { diff --git a/SpaceWizards.Sodium/SodiumException.cs b/CSSUDII.Sodium/SodiumException.cs similarity index 88% rename from SpaceWizards.Sodium/SodiumException.cs rename to CSSUDII.Sodium/SodiumException.cs index 5fe7eac..e3ad4a7 100644 --- a/SpaceWizards.Sodium/SodiumException.cs +++ b/CSSUDII.Sodium/SodiumException.cs @@ -1,4 +1,4 @@ -namespace SpaceWizards.Sodium; +namespace CSSUDII.Sodium; public sealed class SodiumException : Exception { diff --git a/SpaceWizards.Sodium/SodiumHelpers.cs b/CSSUDII.Sodium/SodiumHelpers.cs similarity index 99% rename from SpaceWizards.Sodium/SodiumHelpers.cs rename to CSSUDII.Sodium/SodiumHelpers.cs index 4e640cf..4045418 100644 --- a/SpaceWizards.Sodium/SodiumHelpers.cs +++ b/CSSUDII.Sodium/SodiumHelpers.cs @@ -1,7 +1,7 @@ using System.Buffers; using System.Text; -namespace SpaceWizards.Sodium; +namespace CSSUDII.Sodium; using static Interop.Libsodium; diff --git a/SpaceWizards.Sodium/SodiumInitException.cs b/CSSUDII.Sodium/SodiumInitException.cs similarity index 89% rename from SpaceWizards.Sodium/SodiumInitException.cs rename to CSSUDII.Sodium/SodiumInitException.cs index 973310e..892683a 100644 --- a/SpaceWizards.Sodium/SodiumInitException.cs +++ b/CSSUDII.Sodium/SodiumInitException.cs @@ -1,4 +1,4 @@ -namespace SpaceWizards.Sodium; +namespace CSSUDII.Sodium; [Serializable] public sealed class SodiumInitException : Exception diff --git a/Directory.build.props b/Directory.build.props index 0c155ce..24f1645 100644 --- a/Directory.build.props +++ b/Directory.build.props @@ -3,9 +3,9 @@ MIT Git - https://github.com/space-wizards/SpaceWizards.Sodium + https://git.119.224.65.18.sslip.io/CSSUDII/CSSUDII.Sodium $(RepositoryUrl) - Space Wizards + CSSUDII diff --git a/Scripts/CSSUDII.Sodium.Interop/Generated/Libsodium.cs b/Scripts/CSSUDII.Sodium.Interop/Generated/Libsodium.cs new file mode 100644 index 0000000..af4228f --- /dev/null +++ b/Scripts/CSSUDII.Sodium.Interop/Generated/Libsodium.cs @@ -0,0 +1,3053 @@ +using System; +using System.Runtime.InteropServices; + +namespace CSSUDII.Sodium.Interop +{ + public static unsafe partial class Libsodium + { + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int sodium_init(); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int sodium_set_misuse_handler([NativeTypeName("void (*)()")] delegate* unmanaged[Cdecl] handler); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern void sodium_misuse(); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int crypto_aead_aes256gcm_is_available(); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("size_t")] + public static extern nuint crypto_aead_aes256gcm_keybytes(); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("size_t")] + public static extern nuint crypto_aead_aes256gcm_nsecbytes(); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("size_t")] + public static extern nuint crypto_aead_aes256gcm_npubbytes(); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("size_t")] + public static extern nuint crypto_aead_aes256gcm_abytes(); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("size_t")] + public static extern nuint crypto_aead_aes256gcm_messagebytes_max(); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("size_t")] + public static extern nuint crypto_aead_aes256gcm_statebytes(); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int crypto_aead_aes256gcm_encrypt([NativeTypeName("unsigned char *")] byte* c, [NativeTypeName("unsigned long long *")] ulong* clen_p, [NativeTypeName("const unsigned char *")] byte* m, [NativeTypeName("unsigned long long")] ulong mlen, [NativeTypeName("const unsigned char *")] byte* ad, [NativeTypeName("unsigned long long")] ulong adlen, [NativeTypeName("const unsigned char *")] byte* nsec, [NativeTypeName("const unsigned char *")] byte* npub, [NativeTypeName("const unsigned char *")] byte* k); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int crypto_aead_aes256gcm_decrypt([NativeTypeName("unsigned char *")] byte* m, [NativeTypeName("unsigned long long *")] ulong* mlen_p, [NativeTypeName("unsigned char *")] byte* nsec, [NativeTypeName("const unsigned char *")] byte* c, [NativeTypeName("unsigned long long")] ulong clen, [NativeTypeName("const unsigned char *")] byte* ad, [NativeTypeName("unsigned long long")] ulong adlen, [NativeTypeName("const unsigned char *")] byte* npub, [NativeTypeName("const unsigned char *")] byte* k); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int crypto_aead_aes256gcm_encrypt_detached([NativeTypeName("unsigned char *")] byte* c, [NativeTypeName("unsigned char *")] byte* mac, [NativeTypeName("unsigned long long *")] ulong* maclen_p, [NativeTypeName("const unsigned char *")] byte* m, [NativeTypeName("unsigned long long")] ulong mlen, [NativeTypeName("const unsigned char *")] byte* ad, [NativeTypeName("unsigned long long")] ulong adlen, [NativeTypeName("const unsigned char *")] byte* nsec, [NativeTypeName("const unsigned char *")] byte* npub, [NativeTypeName("const unsigned char *")] byte* k); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int crypto_aead_aes256gcm_decrypt_detached([NativeTypeName("unsigned char *")] byte* m, [NativeTypeName("unsigned char *")] byte* nsec, [NativeTypeName("const unsigned char *")] byte* c, [NativeTypeName("unsigned long long")] ulong clen, [NativeTypeName("const unsigned char *")] byte* mac, [NativeTypeName("const unsigned char *")] byte* ad, [NativeTypeName("unsigned long long")] ulong adlen, [NativeTypeName("const unsigned char *")] byte* npub, [NativeTypeName("const unsigned char *")] byte* k); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int crypto_aead_aes256gcm_beforenm(crypto_aead_aes256gcm_state* ctx_, [NativeTypeName("const unsigned char *")] byte* k); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int crypto_aead_aes256gcm_encrypt_afternm([NativeTypeName("unsigned char *")] byte* c, [NativeTypeName("unsigned long long *")] ulong* clen_p, [NativeTypeName("const unsigned char *")] byte* m, [NativeTypeName("unsigned long long")] ulong mlen, [NativeTypeName("const unsigned char *")] byte* ad, [NativeTypeName("unsigned long long")] ulong adlen, [NativeTypeName("const unsigned char *")] byte* nsec, [NativeTypeName("const unsigned char *")] byte* npub, [NativeTypeName("const crypto_aead_aes256gcm_state *")] crypto_aead_aes256gcm_state* ctx_); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int crypto_aead_aes256gcm_decrypt_afternm([NativeTypeName("unsigned char *")] byte* m, [NativeTypeName("unsigned long long *")] ulong* mlen_p, [NativeTypeName("unsigned char *")] byte* nsec, [NativeTypeName("const unsigned char *")] byte* c, [NativeTypeName("unsigned long long")] ulong clen, [NativeTypeName("const unsigned char *")] byte* ad, [NativeTypeName("unsigned long long")] ulong adlen, [NativeTypeName("const unsigned char *")] byte* npub, [NativeTypeName("const crypto_aead_aes256gcm_state *")] crypto_aead_aes256gcm_state* ctx_); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int crypto_aead_aes256gcm_encrypt_detached_afternm([NativeTypeName("unsigned char *")] byte* c, [NativeTypeName("unsigned char *")] byte* mac, [NativeTypeName("unsigned long long *")] ulong* maclen_p, [NativeTypeName("const unsigned char *")] byte* m, [NativeTypeName("unsigned long long")] ulong mlen, [NativeTypeName("const unsigned char *")] byte* ad, [NativeTypeName("unsigned long long")] ulong adlen, [NativeTypeName("const unsigned char *")] byte* nsec, [NativeTypeName("const unsigned char *")] byte* npub, [NativeTypeName("const crypto_aead_aes256gcm_state *")] crypto_aead_aes256gcm_state* ctx_); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int crypto_aead_aes256gcm_decrypt_detached_afternm([NativeTypeName("unsigned char *")] byte* m, [NativeTypeName("unsigned char *")] byte* nsec, [NativeTypeName("const unsigned char *")] byte* c, [NativeTypeName("unsigned long long")] ulong clen, [NativeTypeName("const unsigned char *")] byte* mac, [NativeTypeName("const unsigned char *")] byte* ad, [NativeTypeName("unsigned long long")] ulong adlen, [NativeTypeName("const unsigned char *")] byte* npub, [NativeTypeName("const crypto_aead_aes256gcm_state *")] crypto_aead_aes256gcm_state* ctx_); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern void crypto_aead_aes256gcm_keygen([NativeTypeName("unsigned char[32]")] byte* k); + + [NativeTypeName("#define crypto_aead_aes256gcm_KEYBYTES 32U")] + public const uint crypto_aead_aes256gcm_KEYBYTES = 32U; + + [NativeTypeName("#define crypto_aead_aes256gcm_NSECBYTES 0U")] + public const uint crypto_aead_aes256gcm_NSECBYTES = 0U; + + [NativeTypeName("#define crypto_aead_aes256gcm_NPUBBYTES 12U")] + public const uint crypto_aead_aes256gcm_NPUBBYTES = 12U; + + [NativeTypeName("#define crypto_aead_aes256gcm_ABYTES 16U")] + public const uint crypto_aead_aes256gcm_ABYTES = 16U; + + [NativeTypeName("#define crypto_aead_aes256gcm_MESSAGEBYTES_MAX SODIUM_MIN(SODIUM_SIZE_MAX - crypto_aead_aes256gcm_ABYTES, \\\n (16ULL * ((1ULL << 32) - 2ULL)))")] + public const ulong crypto_aead_aes256gcm_MESSAGEBYTES_MAX = unchecked((((0xffffffffffffffffUL) < (0xffffffffffffffffUL) ? (0xffffffffffffffffUL) : (0xffffffffffffffffUL)) - 16U) < ((16UL * ((1UL << 32) - 2UL))) ? (((0xffffffffffffffffUL) < (0xffffffffffffffffUL) ? (0xffffffffffffffffUL) : (0xffffffffffffffffUL)) - 16U) : ((16UL * ((1UL << 32) - 2UL)))); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("size_t")] + public static extern nuint crypto_aead_chacha20poly1305_ietf_keybytes(); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("size_t")] + public static extern nuint crypto_aead_chacha20poly1305_ietf_nsecbytes(); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("size_t")] + public static extern nuint crypto_aead_chacha20poly1305_ietf_npubbytes(); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("size_t")] + public static extern nuint crypto_aead_chacha20poly1305_ietf_abytes(); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("size_t")] + public static extern nuint crypto_aead_chacha20poly1305_ietf_messagebytes_max(); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int crypto_aead_chacha20poly1305_ietf_encrypt([NativeTypeName("unsigned char *")] byte* c, [NativeTypeName("unsigned long long *")] ulong* clen_p, [NativeTypeName("const unsigned char *")] byte* m, [NativeTypeName("unsigned long long")] ulong mlen, [NativeTypeName("const unsigned char *")] byte* ad, [NativeTypeName("unsigned long long")] ulong adlen, [NativeTypeName("const unsigned char *")] byte* nsec, [NativeTypeName("const unsigned char *")] byte* npub, [NativeTypeName("const unsigned char *")] byte* k); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int crypto_aead_chacha20poly1305_ietf_decrypt([NativeTypeName("unsigned char *")] byte* m, [NativeTypeName("unsigned long long *")] ulong* mlen_p, [NativeTypeName("unsigned char *")] byte* nsec, [NativeTypeName("const unsigned char *")] byte* c, [NativeTypeName("unsigned long long")] ulong clen, [NativeTypeName("const unsigned char *")] byte* ad, [NativeTypeName("unsigned long long")] ulong adlen, [NativeTypeName("const unsigned char *")] byte* npub, [NativeTypeName("const unsigned char *")] byte* k); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int crypto_aead_chacha20poly1305_ietf_encrypt_detached([NativeTypeName("unsigned char *")] byte* c, [NativeTypeName("unsigned char *")] byte* mac, [NativeTypeName("unsigned long long *")] ulong* maclen_p, [NativeTypeName("const unsigned char *")] byte* m, [NativeTypeName("unsigned long long")] ulong mlen, [NativeTypeName("const unsigned char *")] byte* ad, [NativeTypeName("unsigned long long")] ulong adlen, [NativeTypeName("const unsigned char *")] byte* nsec, [NativeTypeName("const unsigned char *")] byte* npub, [NativeTypeName("const unsigned char *")] byte* k); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int crypto_aead_chacha20poly1305_ietf_decrypt_detached([NativeTypeName("unsigned char *")] byte* m, [NativeTypeName("unsigned char *")] byte* nsec, [NativeTypeName("const unsigned char *")] byte* c, [NativeTypeName("unsigned long long")] ulong clen, [NativeTypeName("const unsigned char *")] byte* mac, [NativeTypeName("const unsigned char *")] byte* ad, [NativeTypeName("unsigned long long")] ulong adlen, [NativeTypeName("const unsigned char *")] byte* npub, [NativeTypeName("const unsigned char *")] byte* k); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern void crypto_aead_chacha20poly1305_ietf_keygen([NativeTypeName("unsigned char[32]")] byte* k); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("size_t")] + public static extern nuint crypto_aead_chacha20poly1305_keybytes(); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("size_t")] + public static extern nuint crypto_aead_chacha20poly1305_nsecbytes(); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("size_t")] + public static extern nuint crypto_aead_chacha20poly1305_npubbytes(); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("size_t")] + public static extern nuint crypto_aead_chacha20poly1305_abytes(); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("size_t")] + public static extern nuint crypto_aead_chacha20poly1305_messagebytes_max(); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int crypto_aead_chacha20poly1305_encrypt([NativeTypeName("unsigned char *")] byte* c, [NativeTypeName("unsigned long long *")] ulong* clen_p, [NativeTypeName("const unsigned char *")] byte* m, [NativeTypeName("unsigned long long")] ulong mlen, [NativeTypeName("const unsigned char *")] byte* ad, [NativeTypeName("unsigned long long")] ulong adlen, [NativeTypeName("const unsigned char *")] byte* nsec, [NativeTypeName("const unsigned char *")] byte* npub, [NativeTypeName("const unsigned char *")] byte* k); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int crypto_aead_chacha20poly1305_decrypt([NativeTypeName("unsigned char *")] byte* m, [NativeTypeName("unsigned long long *")] ulong* mlen_p, [NativeTypeName("unsigned char *")] byte* nsec, [NativeTypeName("const unsigned char *")] byte* c, [NativeTypeName("unsigned long long")] ulong clen, [NativeTypeName("const unsigned char *")] byte* ad, [NativeTypeName("unsigned long long")] ulong adlen, [NativeTypeName("const unsigned char *")] byte* npub, [NativeTypeName("const unsigned char *")] byte* k); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int crypto_aead_chacha20poly1305_encrypt_detached([NativeTypeName("unsigned char *")] byte* c, [NativeTypeName("unsigned char *")] byte* mac, [NativeTypeName("unsigned long long *")] ulong* maclen_p, [NativeTypeName("const unsigned char *")] byte* m, [NativeTypeName("unsigned long long")] ulong mlen, [NativeTypeName("const unsigned char *")] byte* ad, [NativeTypeName("unsigned long long")] ulong adlen, [NativeTypeName("const unsigned char *")] byte* nsec, [NativeTypeName("const unsigned char *")] byte* npub, [NativeTypeName("const unsigned char *")] byte* k); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int crypto_aead_chacha20poly1305_decrypt_detached([NativeTypeName("unsigned char *")] byte* m, [NativeTypeName("unsigned char *")] byte* nsec, [NativeTypeName("const unsigned char *")] byte* c, [NativeTypeName("unsigned long long")] ulong clen, [NativeTypeName("const unsigned char *")] byte* mac, [NativeTypeName("const unsigned char *")] byte* ad, [NativeTypeName("unsigned long long")] ulong adlen, [NativeTypeName("const unsigned char *")] byte* npub, [NativeTypeName("const unsigned char *")] byte* k); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern void crypto_aead_chacha20poly1305_keygen([NativeTypeName("unsigned char[32]")] byte* k); + + [NativeTypeName("#define crypto_aead_chacha20poly1305_ietf_KEYBYTES 32U")] + public const uint crypto_aead_chacha20poly1305_ietf_KEYBYTES = 32U; + + [NativeTypeName("#define crypto_aead_chacha20poly1305_ietf_NSECBYTES 0U")] + public const uint crypto_aead_chacha20poly1305_ietf_NSECBYTES = 0U; + + [NativeTypeName("#define crypto_aead_chacha20poly1305_ietf_NPUBBYTES 12U")] + public const uint crypto_aead_chacha20poly1305_ietf_NPUBBYTES = 12U; + + [NativeTypeName("#define crypto_aead_chacha20poly1305_ietf_ABYTES 16U")] + public const uint crypto_aead_chacha20poly1305_ietf_ABYTES = 16U; + + [NativeTypeName("#define crypto_aead_chacha20poly1305_ietf_MESSAGEBYTES_MAX SODIUM_MIN(SODIUM_SIZE_MAX - crypto_aead_chacha20poly1305_ietf_ABYTES, \\\n (64ULL * ((1ULL << 32) - 1ULL)))")] + public const ulong crypto_aead_chacha20poly1305_ietf_MESSAGEBYTES_MAX = unchecked((((0xffffffffffffffffUL) < (0xffffffffffffffffUL) ? (0xffffffffffffffffUL) : (0xffffffffffffffffUL)) - 16U) < ((64UL * ((1UL << 32) - 1UL))) ? (((0xffffffffffffffffUL) < (0xffffffffffffffffUL) ? (0xffffffffffffffffUL) : (0xffffffffffffffffUL)) - 16U) : ((64UL * ((1UL << 32) - 1UL)))); + + [NativeTypeName("#define crypto_aead_chacha20poly1305_KEYBYTES 32U")] + public const uint crypto_aead_chacha20poly1305_KEYBYTES = 32U; + + [NativeTypeName("#define crypto_aead_chacha20poly1305_NSECBYTES 0U")] + public const uint crypto_aead_chacha20poly1305_NSECBYTES = 0U; + + [NativeTypeName("#define crypto_aead_chacha20poly1305_NPUBBYTES 8U")] + public const uint crypto_aead_chacha20poly1305_NPUBBYTES = 8U; + + [NativeTypeName("#define crypto_aead_chacha20poly1305_ABYTES 16U")] + public const uint crypto_aead_chacha20poly1305_ABYTES = 16U; + + [NativeTypeName("#define crypto_aead_chacha20poly1305_MESSAGEBYTES_MAX (SODIUM_SIZE_MAX - crypto_aead_chacha20poly1305_ABYTES)")] + public const ulong crypto_aead_chacha20poly1305_MESSAGEBYTES_MAX = (((0xffffffffffffffffUL) < (0xffffffffffffffffUL) ? (0xffffffffffffffffUL) : (0xffffffffffffffffUL)) - 16U); + + [NativeTypeName("#define crypto_aead_chacha20poly1305_IETF_KEYBYTES crypto_aead_chacha20poly1305_ietf_KEYBYTES")] + public const uint crypto_aead_chacha20poly1305_IETF_KEYBYTES = 32U; + + [NativeTypeName("#define crypto_aead_chacha20poly1305_IETF_NSECBYTES crypto_aead_chacha20poly1305_ietf_NSECBYTES")] + public const uint crypto_aead_chacha20poly1305_IETF_NSECBYTES = 0U; + + [NativeTypeName("#define crypto_aead_chacha20poly1305_IETF_NPUBBYTES crypto_aead_chacha20poly1305_ietf_NPUBBYTES")] + public const uint crypto_aead_chacha20poly1305_IETF_NPUBBYTES = 12U; + + [NativeTypeName("#define crypto_aead_chacha20poly1305_IETF_ABYTES crypto_aead_chacha20poly1305_ietf_ABYTES")] + public const uint crypto_aead_chacha20poly1305_IETF_ABYTES = 16U; + + [NativeTypeName("#define crypto_aead_chacha20poly1305_IETF_MESSAGEBYTES_MAX crypto_aead_chacha20poly1305_ietf_MESSAGEBYTES_MAX")] + public const ulong crypto_aead_chacha20poly1305_IETF_MESSAGEBYTES_MAX = unchecked((((0xffffffffffffffffUL) < (0xffffffffffffffffUL) ? (0xffffffffffffffffUL) : (0xffffffffffffffffUL)) - 16U) < ((64UL * ((1UL << 32) - 1UL))) ? (((0xffffffffffffffffUL) < (0xffffffffffffffffUL) ? (0xffffffffffffffffUL) : (0xffffffffffffffffUL)) - 16U) : ((64UL * ((1UL << 32) - 1UL)))); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("size_t")] + public static extern nuint crypto_aead_xchacha20poly1305_ietf_keybytes(); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("size_t")] + public static extern nuint crypto_aead_xchacha20poly1305_ietf_nsecbytes(); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("size_t")] + public static extern nuint crypto_aead_xchacha20poly1305_ietf_npubbytes(); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("size_t")] + public static extern nuint crypto_aead_xchacha20poly1305_ietf_abytes(); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("size_t")] + public static extern nuint crypto_aead_xchacha20poly1305_ietf_messagebytes_max(); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int crypto_aead_xchacha20poly1305_ietf_encrypt([NativeTypeName("unsigned char *")] byte* c, [NativeTypeName("unsigned long long *")] ulong* clen_p, [NativeTypeName("const unsigned char *")] byte* m, [NativeTypeName("unsigned long long")] ulong mlen, [NativeTypeName("const unsigned char *")] byte* ad, [NativeTypeName("unsigned long long")] ulong adlen, [NativeTypeName("const unsigned char *")] byte* nsec, [NativeTypeName("const unsigned char *")] byte* npub, [NativeTypeName("const unsigned char *")] byte* k); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int crypto_aead_xchacha20poly1305_ietf_decrypt([NativeTypeName("unsigned char *")] byte* m, [NativeTypeName("unsigned long long *")] ulong* mlen_p, [NativeTypeName("unsigned char *")] byte* nsec, [NativeTypeName("const unsigned char *")] byte* c, [NativeTypeName("unsigned long long")] ulong clen, [NativeTypeName("const unsigned char *")] byte* ad, [NativeTypeName("unsigned long long")] ulong adlen, [NativeTypeName("const unsigned char *")] byte* npub, [NativeTypeName("const unsigned char *")] byte* k); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int crypto_aead_xchacha20poly1305_ietf_encrypt_detached([NativeTypeName("unsigned char *")] byte* c, [NativeTypeName("unsigned char *")] byte* mac, [NativeTypeName("unsigned long long *")] ulong* maclen_p, [NativeTypeName("const unsigned char *")] byte* m, [NativeTypeName("unsigned long long")] ulong mlen, [NativeTypeName("const unsigned char *")] byte* ad, [NativeTypeName("unsigned long long")] ulong adlen, [NativeTypeName("const unsigned char *")] byte* nsec, [NativeTypeName("const unsigned char *")] byte* npub, [NativeTypeName("const unsigned char *")] byte* k); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int crypto_aead_xchacha20poly1305_ietf_decrypt_detached([NativeTypeName("unsigned char *")] byte* m, [NativeTypeName("unsigned char *")] byte* nsec, [NativeTypeName("const unsigned char *")] byte* c, [NativeTypeName("unsigned long long")] ulong clen, [NativeTypeName("const unsigned char *")] byte* mac, [NativeTypeName("const unsigned char *")] byte* ad, [NativeTypeName("unsigned long long")] ulong adlen, [NativeTypeName("const unsigned char *")] byte* npub, [NativeTypeName("const unsigned char *")] byte* k); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern void crypto_aead_xchacha20poly1305_ietf_keygen([NativeTypeName("unsigned char[32]")] byte* k); + + [NativeTypeName("#define crypto_aead_xchacha20poly1305_ietf_KEYBYTES 32U")] + public const uint crypto_aead_xchacha20poly1305_ietf_KEYBYTES = 32U; + + [NativeTypeName("#define crypto_aead_xchacha20poly1305_ietf_NSECBYTES 0U")] + public const uint crypto_aead_xchacha20poly1305_ietf_NSECBYTES = 0U; + + [NativeTypeName("#define crypto_aead_xchacha20poly1305_ietf_NPUBBYTES 24U")] + public const uint crypto_aead_xchacha20poly1305_ietf_NPUBBYTES = 24U; + + [NativeTypeName("#define crypto_aead_xchacha20poly1305_ietf_ABYTES 16U")] + public const uint crypto_aead_xchacha20poly1305_ietf_ABYTES = 16U; + + [NativeTypeName("#define crypto_aead_xchacha20poly1305_ietf_MESSAGEBYTES_MAX (SODIUM_SIZE_MAX - crypto_aead_xchacha20poly1305_ietf_ABYTES)")] + public const ulong crypto_aead_xchacha20poly1305_ietf_MESSAGEBYTES_MAX = (((0xffffffffffffffffUL) < (0xffffffffffffffffUL) ? (0xffffffffffffffffUL) : (0xffffffffffffffffUL)) - 16U); + + [NativeTypeName("#define crypto_aead_xchacha20poly1305_IETF_KEYBYTES crypto_aead_xchacha20poly1305_ietf_KEYBYTES")] + public const uint crypto_aead_xchacha20poly1305_IETF_KEYBYTES = 32U; + + [NativeTypeName("#define crypto_aead_xchacha20poly1305_IETF_NSECBYTES crypto_aead_xchacha20poly1305_ietf_NSECBYTES")] + public const uint crypto_aead_xchacha20poly1305_IETF_NSECBYTES = 0U; + + [NativeTypeName("#define crypto_aead_xchacha20poly1305_IETF_NPUBBYTES crypto_aead_xchacha20poly1305_ietf_NPUBBYTES")] + public const uint crypto_aead_xchacha20poly1305_IETF_NPUBBYTES = 24U; + + [NativeTypeName("#define crypto_aead_xchacha20poly1305_IETF_ABYTES crypto_aead_xchacha20poly1305_ietf_ABYTES")] + public const uint crypto_aead_xchacha20poly1305_IETF_ABYTES = 16U; + + [NativeTypeName("#define crypto_aead_xchacha20poly1305_IETF_MESSAGEBYTES_MAX crypto_aead_xchacha20poly1305_ietf_MESSAGEBYTES_MAX")] + public const ulong crypto_aead_xchacha20poly1305_IETF_MESSAGEBYTES_MAX = (((0xffffffffffffffffUL) < (0xffffffffffffffffUL) ? (0xffffffffffffffffUL) : (0xffffffffffffffffUL)) - 16U); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("size_t")] + public static extern nuint crypto_auth_bytes(); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("size_t")] + public static extern nuint crypto_auth_keybytes(); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("const char *")] + public static extern sbyte* crypto_auth_primitive(); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int crypto_auth([NativeTypeName("unsigned char *")] byte* @out, [NativeTypeName("const unsigned char *")] byte* @in, [NativeTypeName("unsigned long long")] ulong inlen, [NativeTypeName("const unsigned char *")] byte* k); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int crypto_auth_verify([NativeTypeName("const unsigned char *")] byte* h, [NativeTypeName("const unsigned char *")] byte* @in, [NativeTypeName("unsigned long long")] ulong inlen, [NativeTypeName("const unsigned char *")] byte* k); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern void crypto_auth_keygen([NativeTypeName("unsigned char[32]")] byte* k); + + [NativeTypeName("#define crypto_auth_BYTES crypto_auth_hmacsha512256_BYTES")] + public const uint crypto_auth_BYTES = 32U; + + [NativeTypeName("#define crypto_auth_KEYBYTES crypto_auth_hmacsha512256_KEYBYTES")] + public const uint crypto_auth_KEYBYTES = 32U; + + [NativeTypeName("#define crypto_auth_PRIMITIVE \"hmacsha512256\"")] + public static ReadOnlySpan crypto_auth_PRIMITIVE => "hmacsha512256"u8; + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("size_t")] + public static extern nuint crypto_auth_hmacsha256_bytes(); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("size_t")] + public static extern nuint crypto_auth_hmacsha256_keybytes(); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int crypto_auth_hmacsha256([NativeTypeName("unsigned char *")] byte* @out, [NativeTypeName("const unsigned char *")] byte* @in, [NativeTypeName("unsigned long long")] ulong inlen, [NativeTypeName("const unsigned char *")] byte* k); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int crypto_auth_hmacsha256_verify([NativeTypeName("const unsigned char *")] byte* h, [NativeTypeName("const unsigned char *")] byte* @in, [NativeTypeName("unsigned long long")] ulong inlen, [NativeTypeName("const unsigned char *")] byte* k); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("size_t")] + public static extern nuint crypto_auth_hmacsha256_statebytes(); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int crypto_auth_hmacsha256_init(crypto_auth_hmacsha256_state* state, [NativeTypeName("const unsigned char *")] byte* key, [NativeTypeName("size_t")] nuint keylen); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int crypto_auth_hmacsha256_update(crypto_auth_hmacsha256_state* state, [NativeTypeName("const unsigned char *")] byte* @in, [NativeTypeName("unsigned long long")] ulong inlen); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int crypto_auth_hmacsha256_final(crypto_auth_hmacsha256_state* state, [NativeTypeName("unsigned char *")] byte* @out); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern void crypto_auth_hmacsha256_keygen([NativeTypeName("unsigned char[32]")] byte* k); + + [NativeTypeName("#define crypto_auth_hmacsha256_BYTES 32U")] + public const uint crypto_auth_hmacsha256_BYTES = 32U; + + [NativeTypeName("#define crypto_auth_hmacsha256_KEYBYTES 32U")] + public const uint crypto_auth_hmacsha256_KEYBYTES = 32U; + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("size_t")] + public static extern nuint crypto_auth_hmacsha512_bytes(); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("size_t")] + public static extern nuint crypto_auth_hmacsha512_keybytes(); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int crypto_auth_hmacsha512([NativeTypeName("unsigned char *")] byte* @out, [NativeTypeName("const unsigned char *")] byte* @in, [NativeTypeName("unsigned long long")] ulong inlen, [NativeTypeName("const unsigned char *")] byte* k); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int crypto_auth_hmacsha512_verify([NativeTypeName("const unsigned char *")] byte* h, [NativeTypeName("const unsigned char *")] byte* @in, [NativeTypeName("unsigned long long")] ulong inlen, [NativeTypeName("const unsigned char *")] byte* k); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("size_t")] + public static extern nuint crypto_auth_hmacsha512_statebytes(); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int crypto_auth_hmacsha512_init([NativeTypeName("crypto_auth_hmacsha512_state *")] crypto_auth_hmacsha512256_state* state, [NativeTypeName("const unsigned char *")] byte* key, [NativeTypeName("size_t")] nuint keylen); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int crypto_auth_hmacsha512_update([NativeTypeName("crypto_auth_hmacsha512_state *")] crypto_auth_hmacsha512256_state* state, [NativeTypeName("const unsigned char *")] byte* @in, [NativeTypeName("unsigned long long")] ulong inlen); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int crypto_auth_hmacsha512_final([NativeTypeName("crypto_auth_hmacsha512_state *")] crypto_auth_hmacsha512256_state* state, [NativeTypeName("unsigned char *")] byte* @out); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern void crypto_auth_hmacsha512_keygen([NativeTypeName("unsigned char[32]")] byte* k); + + [NativeTypeName("#define crypto_auth_hmacsha512_BYTES 64U")] + public const uint crypto_auth_hmacsha512_BYTES = 64U; + + [NativeTypeName("#define crypto_auth_hmacsha512_KEYBYTES 32U")] + public const uint crypto_auth_hmacsha512_KEYBYTES = 32U; + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("size_t")] + public static extern nuint crypto_auth_hmacsha512256_bytes(); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("size_t")] + public static extern nuint crypto_auth_hmacsha512256_keybytes(); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int crypto_auth_hmacsha512256([NativeTypeName("unsigned char *")] byte* @out, [NativeTypeName("const unsigned char *")] byte* @in, [NativeTypeName("unsigned long long")] ulong inlen, [NativeTypeName("const unsigned char *")] byte* k); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int crypto_auth_hmacsha512256_verify([NativeTypeName("const unsigned char *")] byte* h, [NativeTypeName("const unsigned char *")] byte* @in, [NativeTypeName("unsigned long long")] ulong inlen, [NativeTypeName("const unsigned char *")] byte* k); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("size_t")] + public static extern nuint crypto_auth_hmacsha512256_statebytes(); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int crypto_auth_hmacsha512256_init(crypto_auth_hmacsha512256_state* state, [NativeTypeName("const unsigned char *")] byte* key, [NativeTypeName("size_t")] nuint keylen); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int crypto_auth_hmacsha512256_update(crypto_auth_hmacsha512256_state* state, [NativeTypeName("const unsigned char *")] byte* @in, [NativeTypeName("unsigned long long")] ulong inlen); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int crypto_auth_hmacsha512256_final(crypto_auth_hmacsha512256_state* state, [NativeTypeName("unsigned char *")] byte* @out); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern void crypto_auth_hmacsha512256_keygen([NativeTypeName("unsigned char[32]")] byte* k); + + [NativeTypeName("#define crypto_auth_hmacsha512256_BYTES 32U")] + public const uint crypto_auth_hmacsha512256_BYTES = 32U; + + [NativeTypeName("#define crypto_auth_hmacsha512256_KEYBYTES 32U")] + public const uint crypto_auth_hmacsha512256_KEYBYTES = 32U; + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("size_t")] + public static extern nuint crypto_box_seedbytes(); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("size_t")] + public static extern nuint crypto_box_publickeybytes(); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("size_t")] + public static extern nuint crypto_box_secretkeybytes(); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("size_t")] + public static extern nuint crypto_box_noncebytes(); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("size_t")] + public static extern nuint crypto_box_macbytes(); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("size_t")] + public static extern nuint crypto_box_messagebytes_max(); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("const char *")] + public static extern sbyte* crypto_box_primitive(); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int crypto_box_seed_keypair([NativeTypeName("unsigned char *")] byte* pk, [NativeTypeName("unsigned char *")] byte* sk, [NativeTypeName("const unsigned char *")] byte* seed); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int crypto_box_keypair([NativeTypeName("unsigned char *")] byte* pk, [NativeTypeName("unsigned char *")] byte* sk); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int crypto_box_easy([NativeTypeName("unsigned char *")] byte* c, [NativeTypeName("const unsigned char *")] byte* m, [NativeTypeName("unsigned long long")] ulong mlen, [NativeTypeName("const unsigned char *")] byte* n, [NativeTypeName("const unsigned char *")] byte* pk, [NativeTypeName("const unsigned char *")] byte* sk); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int crypto_box_open_easy([NativeTypeName("unsigned char *")] byte* m, [NativeTypeName("const unsigned char *")] byte* c, [NativeTypeName("unsigned long long")] ulong clen, [NativeTypeName("const unsigned char *")] byte* n, [NativeTypeName("const unsigned char *")] byte* pk, [NativeTypeName("const unsigned char *")] byte* sk); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int crypto_box_detached([NativeTypeName("unsigned char *")] byte* c, [NativeTypeName("unsigned char *")] byte* mac, [NativeTypeName("const unsigned char *")] byte* m, [NativeTypeName("unsigned long long")] ulong mlen, [NativeTypeName("const unsigned char *")] byte* n, [NativeTypeName("const unsigned char *")] byte* pk, [NativeTypeName("const unsigned char *")] byte* sk); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int crypto_box_open_detached([NativeTypeName("unsigned char *")] byte* m, [NativeTypeName("const unsigned char *")] byte* c, [NativeTypeName("const unsigned char *")] byte* mac, [NativeTypeName("unsigned long long")] ulong clen, [NativeTypeName("const unsigned char *")] byte* n, [NativeTypeName("const unsigned char *")] byte* pk, [NativeTypeName("const unsigned char *")] byte* sk); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("size_t")] + public static extern nuint crypto_box_beforenmbytes(); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int crypto_box_beforenm([NativeTypeName("unsigned char *")] byte* k, [NativeTypeName("const unsigned char *")] byte* pk, [NativeTypeName("const unsigned char *")] byte* sk); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int crypto_box_easy_afternm([NativeTypeName("unsigned char *")] byte* c, [NativeTypeName("const unsigned char *")] byte* m, [NativeTypeName("unsigned long long")] ulong mlen, [NativeTypeName("const unsigned char *")] byte* n, [NativeTypeName("const unsigned char *")] byte* k); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int crypto_box_open_easy_afternm([NativeTypeName("unsigned char *")] byte* m, [NativeTypeName("const unsigned char *")] byte* c, [NativeTypeName("unsigned long long")] ulong clen, [NativeTypeName("const unsigned char *")] byte* n, [NativeTypeName("const unsigned char *")] byte* k); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int crypto_box_detached_afternm([NativeTypeName("unsigned char *")] byte* c, [NativeTypeName("unsigned char *")] byte* mac, [NativeTypeName("const unsigned char *")] byte* m, [NativeTypeName("unsigned long long")] ulong mlen, [NativeTypeName("const unsigned char *")] byte* n, [NativeTypeName("const unsigned char *")] byte* k); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int crypto_box_open_detached_afternm([NativeTypeName("unsigned char *")] byte* m, [NativeTypeName("const unsigned char *")] byte* c, [NativeTypeName("const unsigned char *")] byte* mac, [NativeTypeName("unsigned long long")] ulong clen, [NativeTypeName("const unsigned char *")] byte* n, [NativeTypeName("const unsigned char *")] byte* k); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("size_t")] + public static extern nuint crypto_box_sealbytes(); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int crypto_box_seal([NativeTypeName("unsigned char *")] byte* c, [NativeTypeName("const unsigned char *")] byte* m, [NativeTypeName("unsigned long long")] ulong mlen, [NativeTypeName("const unsigned char *")] byte* pk); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int crypto_box_seal_open([NativeTypeName("unsigned char *")] byte* m, [NativeTypeName("const unsigned char *")] byte* c, [NativeTypeName("unsigned long long")] ulong clen, [NativeTypeName("const unsigned char *")] byte* pk, [NativeTypeName("const unsigned char *")] byte* sk); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("size_t")] + public static extern nuint crypto_box_zerobytes(); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("size_t")] + public static extern nuint crypto_box_boxzerobytes(); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int crypto_box([NativeTypeName("unsigned char *")] byte* c, [NativeTypeName("const unsigned char *")] byte* m, [NativeTypeName("unsigned long long")] ulong mlen, [NativeTypeName("const unsigned char *")] byte* n, [NativeTypeName("const unsigned char *")] byte* pk, [NativeTypeName("const unsigned char *")] byte* sk); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int crypto_box_open([NativeTypeName("unsigned char *")] byte* m, [NativeTypeName("const unsigned char *")] byte* c, [NativeTypeName("unsigned long long")] ulong clen, [NativeTypeName("const unsigned char *")] byte* n, [NativeTypeName("const unsigned char *")] byte* pk, [NativeTypeName("const unsigned char *")] byte* sk); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int crypto_box_afternm([NativeTypeName("unsigned char *")] byte* c, [NativeTypeName("const unsigned char *")] byte* m, [NativeTypeName("unsigned long long")] ulong mlen, [NativeTypeName("const unsigned char *")] byte* n, [NativeTypeName("const unsigned char *")] byte* k); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int crypto_box_open_afternm([NativeTypeName("unsigned char *")] byte* m, [NativeTypeName("const unsigned char *")] byte* c, [NativeTypeName("unsigned long long")] ulong clen, [NativeTypeName("const unsigned char *")] byte* n, [NativeTypeName("const unsigned char *")] byte* k); + + [NativeTypeName("#define crypto_box_SEEDBYTES crypto_box_curve25519xsalsa20poly1305_SEEDBYTES")] + public const uint crypto_box_SEEDBYTES = 32U; + + [NativeTypeName("#define crypto_box_PUBLICKEYBYTES crypto_box_curve25519xsalsa20poly1305_PUBLICKEYBYTES")] + public const uint crypto_box_PUBLICKEYBYTES = 32U; + + [NativeTypeName("#define crypto_box_SECRETKEYBYTES crypto_box_curve25519xsalsa20poly1305_SECRETKEYBYTES")] + public const uint crypto_box_SECRETKEYBYTES = 32U; + + [NativeTypeName("#define crypto_box_NONCEBYTES crypto_box_curve25519xsalsa20poly1305_NONCEBYTES")] + public const uint crypto_box_NONCEBYTES = 24U; + + [NativeTypeName("#define crypto_box_MACBYTES crypto_box_curve25519xsalsa20poly1305_MACBYTES")] + public const uint crypto_box_MACBYTES = 16U; + + [NativeTypeName("#define crypto_box_MESSAGEBYTES_MAX crypto_box_curve25519xsalsa20poly1305_MESSAGEBYTES_MAX")] + public const ulong crypto_box_MESSAGEBYTES_MAX = (((0xffffffffffffffffUL) < (0xffffffffffffffffUL) ? (0xffffffffffffffffUL) : (0xffffffffffffffffUL)) - 16U); + + [NativeTypeName("#define crypto_box_PRIMITIVE \"curve25519xsalsa20poly1305\"")] + public static ReadOnlySpan crypto_box_PRIMITIVE => "curve25519xsalsa20poly1305"u8; + + [NativeTypeName("#define crypto_box_BEFORENMBYTES crypto_box_curve25519xsalsa20poly1305_BEFORENMBYTES")] + public const uint crypto_box_BEFORENMBYTES = 32U; + + [NativeTypeName("#define crypto_box_SEALBYTES (crypto_box_PUBLICKEYBYTES + crypto_box_MACBYTES)")] + public const uint crypto_box_SEALBYTES = (32U + 16U); + + [NativeTypeName("#define crypto_box_ZEROBYTES crypto_box_curve25519xsalsa20poly1305_ZEROBYTES")] + public const uint crypto_box_ZEROBYTES = (16U + 16U); + + [NativeTypeName("#define crypto_box_BOXZEROBYTES crypto_box_curve25519xsalsa20poly1305_BOXZEROBYTES")] + public const uint crypto_box_BOXZEROBYTES = 16U; + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("size_t")] + public static extern nuint crypto_box_curve25519xchacha20poly1305_seedbytes(); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("size_t")] + public static extern nuint crypto_box_curve25519xchacha20poly1305_publickeybytes(); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("size_t")] + public static extern nuint crypto_box_curve25519xchacha20poly1305_secretkeybytes(); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("size_t")] + public static extern nuint crypto_box_curve25519xchacha20poly1305_beforenmbytes(); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("size_t")] + public static extern nuint crypto_box_curve25519xchacha20poly1305_noncebytes(); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("size_t")] + public static extern nuint crypto_box_curve25519xchacha20poly1305_macbytes(); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("size_t")] + public static extern nuint crypto_box_curve25519xchacha20poly1305_messagebytes_max(); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int crypto_box_curve25519xchacha20poly1305_seed_keypair([NativeTypeName("unsigned char *")] byte* pk, [NativeTypeName("unsigned char *")] byte* sk, [NativeTypeName("const unsigned char *")] byte* seed); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int crypto_box_curve25519xchacha20poly1305_keypair([NativeTypeName("unsigned char *")] byte* pk, [NativeTypeName("unsigned char *")] byte* sk); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int crypto_box_curve25519xchacha20poly1305_easy([NativeTypeName("unsigned char *")] byte* c, [NativeTypeName("const unsigned char *")] byte* m, [NativeTypeName("unsigned long long")] ulong mlen, [NativeTypeName("const unsigned char *")] byte* n, [NativeTypeName("const unsigned char *")] byte* pk, [NativeTypeName("const unsigned char *")] byte* sk); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int crypto_box_curve25519xchacha20poly1305_open_easy([NativeTypeName("unsigned char *")] byte* m, [NativeTypeName("const unsigned char *")] byte* c, [NativeTypeName("unsigned long long")] ulong clen, [NativeTypeName("const unsigned char *")] byte* n, [NativeTypeName("const unsigned char *")] byte* pk, [NativeTypeName("const unsigned char *")] byte* sk); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int crypto_box_curve25519xchacha20poly1305_detached([NativeTypeName("unsigned char *")] byte* c, [NativeTypeName("unsigned char *")] byte* mac, [NativeTypeName("const unsigned char *")] byte* m, [NativeTypeName("unsigned long long")] ulong mlen, [NativeTypeName("const unsigned char *")] byte* n, [NativeTypeName("const unsigned char *")] byte* pk, [NativeTypeName("const unsigned char *")] byte* sk); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int crypto_box_curve25519xchacha20poly1305_open_detached([NativeTypeName("unsigned char *")] byte* m, [NativeTypeName("const unsigned char *")] byte* c, [NativeTypeName("const unsigned char *")] byte* mac, [NativeTypeName("unsigned long long")] ulong clen, [NativeTypeName("const unsigned char *")] byte* n, [NativeTypeName("const unsigned char *")] byte* pk, [NativeTypeName("const unsigned char *")] byte* sk); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int crypto_box_curve25519xchacha20poly1305_beforenm([NativeTypeName("unsigned char *")] byte* k, [NativeTypeName("const unsigned char *")] byte* pk, [NativeTypeName("const unsigned char *")] byte* sk); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int crypto_box_curve25519xchacha20poly1305_easy_afternm([NativeTypeName("unsigned char *")] byte* c, [NativeTypeName("const unsigned char *")] byte* m, [NativeTypeName("unsigned long long")] ulong mlen, [NativeTypeName("const unsigned char *")] byte* n, [NativeTypeName("const unsigned char *")] byte* k); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int crypto_box_curve25519xchacha20poly1305_open_easy_afternm([NativeTypeName("unsigned char *")] byte* m, [NativeTypeName("const unsigned char *")] byte* c, [NativeTypeName("unsigned long long")] ulong clen, [NativeTypeName("const unsigned char *")] byte* n, [NativeTypeName("const unsigned char *")] byte* k); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int crypto_box_curve25519xchacha20poly1305_detached_afternm([NativeTypeName("unsigned char *")] byte* c, [NativeTypeName("unsigned char *")] byte* mac, [NativeTypeName("const unsigned char *")] byte* m, [NativeTypeName("unsigned long long")] ulong mlen, [NativeTypeName("const unsigned char *")] byte* n, [NativeTypeName("const unsigned char *")] byte* k); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int crypto_box_curve25519xchacha20poly1305_open_detached_afternm([NativeTypeName("unsigned char *")] byte* m, [NativeTypeName("const unsigned char *")] byte* c, [NativeTypeName("const unsigned char *")] byte* mac, [NativeTypeName("unsigned long long")] ulong clen, [NativeTypeName("const unsigned char *")] byte* n, [NativeTypeName("const unsigned char *")] byte* k); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("size_t")] + public static extern nuint crypto_box_curve25519xchacha20poly1305_sealbytes(); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int crypto_box_curve25519xchacha20poly1305_seal([NativeTypeName("unsigned char *")] byte* c, [NativeTypeName("const unsigned char *")] byte* m, [NativeTypeName("unsigned long long")] ulong mlen, [NativeTypeName("const unsigned char *")] byte* pk); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int crypto_box_curve25519xchacha20poly1305_seal_open([NativeTypeName("unsigned char *")] byte* m, [NativeTypeName("const unsigned char *")] byte* c, [NativeTypeName("unsigned long long")] ulong clen, [NativeTypeName("const unsigned char *")] byte* pk, [NativeTypeName("const unsigned char *")] byte* sk); + + [NativeTypeName("#define crypto_box_curve25519xchacha20poly1305_SEEDBYTES 32U")] + public const uint crypto_box_curve25519xchacha20poly1305_SEEDBYTES = 32U; + + [NativeTypeName("#define crypto_box_curve25519xchacha20poly1305_PUBLICKEYBYTES 32U")] + public const uint crypto_box_curve25519xchacha20poly1305_PUBLICKEYBYTES = 32U; + + [NativeTypeName("#define crypto_box_curve25519xchacha20poly1305_SECRETKEYBYTES 32U")] + public const uint crypto_box_curve25519xchacha20poly1305_SECRETKEYBYTES = 32U; + + [NativeTypeName("#define crypto_box_curve25519xchacha20poly1305_BEFORENMBYTES 32U")] + public const uint crypto_box_curve25519xchacha20poly1305_BEFORENMBYTES = 32U; + + [NativeTypeName("#define crypto_box_curve25519xchacha20poly1305_NONCEBYTES 24U")] + public const uint crypto_box_curve25519xchacha20poly1305_NONCEBYTES = 24U; + + [NativeTypeName("#define crypto_box_curve25519xchacha20poly1305_MACBYTES 16U")] + public const uint crypto_box_curve25519xchacha20poly1305_MACBYTES = 16U; + + [NativeTypeName("#define crypto_box_curve25519xchacha20poly1305_MESSAGEBYTES_MAX (crypto_stream_xchacha20_MESSAGEBYTES_MAX - crypto_box_curve25519xchacha20poly1305_MACBYTES)")] + public const ulong crypto_box_curve25519xchacha20poly1305_MESSAGEBYTES_MAX = (((0xffffffffffffffffUL) < (0xffffffffffffffffUL) ? (0xffffffffffffffffUL) : (0xffffffffffffffffUL)) - 16U); + + [NativeTypeName("#define crypto_box_curve25519xchacha20poly1305_SEALBYTES (crypto_box_curve25519xchacha20poly1305_PUBLICKEYBYTES + \\\n crypto_box_curve25519xchacha20poly1305_MACBYTES)")] + public const uint crypto_box_curve25519xchacha20poly1305_SEALBYTES = (32U + 16U); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("size_t")] + public static extern nuint crypto_box_curve25519xsalsa20poly1305_seedbytes(); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("size_t")] + public static extern nuint crypto_box_curve25519xsalsa20poly1305_publickeybytes(); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("size_t")] + public static extern nuint crypto_box_curve25519xsalsa20poly1305_secretkeybytes(); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("size_t")] + public static extern nuint crypto_box_curve25519xsalsa20poly1305_beforenmbytes(); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("size_t")] + public static extern nuint crypto_box_curve25519xsalsa20poly1305_noncebytes(); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("size_t")] + public static extern nuint crypto_box_curve25519xsalsa20poly1305_macbytes(); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("size_t")] + public static extern nuint crypto_box_curve25519xsalsa20poly1305_messagebytes_max(); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int crypto_box_curve25519xsalsa20poly1305_seed_keypair([NativeTypeName("unsigned char *")] byte* pk, [NativeTypeName("unsigned char *")] byte* sk, [NativeTypeName("const unsigned char *")] byte* seed); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int crypto_box_curve25519xsalsa20poly1305_keypair([NativeTypeName("unsigned char *")] byte* pk, [NativeTypeName("unsigned char *")] byte* sk); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int crypto_box_curve25519xsalsa20poly1305_beforenm([NativeTypeName("unsigned char *")] byte* k, [NativeTypeName("const unsigned char *")] byte* pk, [NativeTypeName("const unsigned char *")] byte* sk); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("size_t")] + public static extern nuint crypto_box_curve25519xsalsa20poly1305_boxzerobytes(); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("size_t")] + public static extern nuint crypto_box_curve25519xsalsa20poly1305_zerobytes(); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int crypto_box_curve25519xsalsa20poly1305([NativeTypeName("unsigned char *")] byte* c, [NativeTypeName("const unsigned char *")] byte* m, [NativeTypeName("unsigned long long")] ulong mlen, [NativeTypeName("const unsigned char *")] byte* n, [NativeTypeName("const unsigned char *")] byte* pk, [NativeTypeName("const unsigned char *")] byte* sk); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int crypto_box_curve25519xsalsa20poly1305_open([NativeTypeName("unsigned char *")] byte* m, [NativeTypeName("const unsigned char *")] byte* c, [NativeTypeName("unsigned long long")] ulong clen, [NativeTypeName("const unsigned char *")] byte* n, [NativeTypeName("const unsigned char *")] byte* pk, [NativeTypeName("const unsigned char *")] byte* sk); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int crypto_box_curve25519xsalsa20poly1305_afternm([NativeTypeName("unsigned char *")] byte* c, [NativeTypeName("const unsigned char *")] byte* m, [NativeTypeName("unsigned long long")] ulong mlen, [NativeTypeName("const unsigned char *")] byte* n, [NativeTypeName("const unsigned char *")] byte* k); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int crypto_box_curve25519xsalsa20poly1305_open_afternm([NativeTypeName("unsigned char *")] byte* m, [NativeTypeName("const unsigned char *")] byte* c, [NativeTypeName("unsigned long long")] ulong clen, [NativeTypeName("const unsigned char *")] byte* n, [NativeTypeName("const unsigned char *")] byte* k); + + [NativeTypeName("#define crypto_box_curve25519xsalsa20poly1305_SEEDBYTES 32U")] + public const uint crypto_box_curve25519xsalsa20poly1305_SEEDBYTES = 32U; + + [NativeTypeName("#define crypto_box_curve25519xsalsa20poly1305_PUBLICKEYBYTES 32U")] + public const uint crypto_box_curve25519xsalsa20poly1305_PUBLICKEYBYTES = 32U; + + [NativeTypeName("#define crypto_box_curve25519xsalsa20poly1305_SECRETKEYBYTES 32U")] + public const uint crypto_box_curve25519xsalsa20poly1305_SECRETKEYBYTES = 32U; + + [NativeTypeName("#define crypto_box_curve25519xsalsa20poly1305_BEFORENMBYTES 32U")] + public const uint crypto_box_curve25519xsalsa20poly1305_BEFORENMBYTES = 32U; + + [NativeTypeName("#define crypto_box_curve25519xsalsa20poly1305_NONCEBYTES 24U")] + public const uint crypto_box_curve25519xsalsa20poly1305_NONCEBYTES = 24U; + + [NativeTypeName("#define crypto_box_curve25519xsalsa20poly1305_MACBYTES 16U")] + public const uint crypto_box_curve25519xsalsa20poly1305_MACBYTES = 16U; + + [NativeTypeName("#define crypto_box_curve25519xsalsa20poly1305_MESSAGEBYTES_MAX (crypto_stream_xsalsa20_MESSAGEBYTES_MAX - crypto_box_curve25519xsalsa20poly1305_MACBYTES)")] + public const ulong crypto_box_curve25519xsalsa20poly1305_MESSAGEBYTES_MAX = (((0xffffffffffffffffUL) < (0xffffffffffffffffUL) ? (0xffffffffffffffffUL) : (0xffffffffffffffffUL)) - 16U); + + [NativeTypeName("#define crypto_box_curve25519xsalsa20poly1305_BOXZEROBYTES 16U")] + public const uint crypto_box_curve25519xsalsa20poly1305_BOXZEROBYTES = 16U; + + [NativeTypeName("#define crypto_box_curve25519xsalsa20poly1305_ZEROBYTES (crypto_box_curve25519xsalsa20poly1305_BOXZEROBYTES + \\\n crypto_box_curve25519xsalsa20poly1305_MACBYTES)")] + public const uint crypto_box_curve25519xsalsa20poly1305_ZEROBYTES = (16U + 16U); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("size_t")] + public static extern nuint crypto_core_ed25519_bytes(); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("size_t")] + public static extern nuint crypto_core_ed25519_uniformbytes(); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("size_t")] + public static extern nuint crypto_core_ed25519_hashbytes(); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("size_t")] + public static extern nuint crypto_core_ed25519_scalarbytes(); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("size_t")] + public static extern nuint crypto_core_ed25519_nonreducedscalarbytes(); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int crypto_core_ed25519_is_valid_point([NativeTypeName("const unsigned char *")] byte* p); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int crypto_core_ed25519_add([NativeTypeName("unsigned char *")] byte* r, [NativeTypeName("const unsigned char *")] byte* p, [NativeTypeName("const unsigned char *")] byte* q); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int crypto_core_ed25519_sub([NativeTypeName("unsigned char *")] byte* r, [NativeTypeName("const unsigned char *")] byte* p, [NativeTypeName("const unsigned char *")] byte* q); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int crypto_core_ed25519_from_uniform([NativeTypeName("unsigned char *")] byte* p, [NativeTypeName("const unsigned char *")] byte* r); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [Obsolete] + public static extern int crypto_core_ed25519_from_hash([NativeTypeName("unsigned char *")] byte* p, [NativeTypeName("const unsigned char *")] byte* h); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern void crypto_core_ed25519_random([NativeTypeName("unsigned char *")] byte* p); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern void crypto_core_ed25519_scalar_random([NativeTypeName("unsigned char *")] byte* r); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int crypto_core_ed25519_scalar_invert([NativeTypeName("unsigned char *")] byte* recip, [NativeTypeName("const unsigned char *")] byte* s); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern void crypto_core_ed25519_scalar_negate([NativeTypeName("unsigned char *")] byte* neg, [NativeTypeName("const unsigned char *")] byte* s); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern void crypto_core_ed25519_scalar_complement([NativeTypeName("unsigned char *")] byte* comp, [NativeTypeName("const unsigned char *")] byte* s); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern void crypto_core_ed25519_scalar_add([NativeTypeName("unsigned char *")] byte* z, [NativeTypeName("const unsigned char *")] byte* x, [NativeTypeName("const unsigned char *")] byte* y); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern void crypto_core_ed25519_scalar_sub([NativeTypeName("unsigned char *")] byte* z, [NativeTypeName("const unsigned char *")] byte* x, [NativeTypeName("const unsigned char *")] byte* y); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern void crypto_core_ed25519_scalar_mul([NativeTypeName("unsigned char *")] byte* z, [NativeTypeName("const unsigned char *")] byte* x, [NativeTypeName("const unsigned char *")] byte* y); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern void crypto_core_ed25519_scalar_reduce([NativeTypeName("unsigned char *")] byte* r, [NativeTypeName("const unsigned char *")] byte* s); + + [NativeTypeName("#define crypto_core_ed25519_BYTES 32")] + public const int crypto_core_ed25519_BYTES = 32; + + [NativeTypeName("#define crypto_core_ed25519_UNIFORMBYTES 32")] + public const int crypto_core_ed25519_UNIFORMBYTES = 32; + + [NativeTypeName("#define crypto_core_ed25519_HASHBYTES 64")] + public const int crypto_core_ed25519_HASHBYTES = 64; + + [NativeTypeName("#define crypto_core_ed25519_SCALARBYTES 32")] + public const int crypto_core_ed25519_SCALARBYTES = 32; + + [NativeTypeName("#define crypto_core_ed25519_NONREDUCEDSCALARBYTES 64")] + public const int crypto_core_ed25519_NONREDUCEDSCALARBYTES = 64; + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("size_t")] + public static extern nuint crypto_core_hchacha20_outputbytes(); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("size_t")] + public static extern nuint crypto_core_hchacha20_inputbytes(); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("size_t")] + public static extern nuint crypto_core_hchacha20_keybytes(); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("size_t")] + public static extern nuint crypto_core_hchacha20_constbytes(); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int crypto_core_hchacha20([NativeTypeName("unsigned char *")] byte* @out, [NativeTypeName("const unsigned char *")] byte* @in, [NativeTypeName("const unsigned char *")] byte* k, [NativeTypeName("const unsigned char *")] byte* c); + + [NativeTypeName("#define crypto_core_hchacha20_OUTPUTBYTES 32U")] + public const uint crypto_core_hchacha20_OUTPUTBYTES = 32U; + + [NativeTypeName("#define crypto_core_hchacha20_INPUTBYTES 16U")] + public const uint crypto_core_hchacha20_INPUTBYTES = 16U; + + [NativeTypeName("#define crypto_core_hchacha20_KEYBYTES 32U")] + public const uint crypto_core_hchacha20_KEYBYTES = 32U; + + [NativeTypeName("#define crypto_core_hchacha20_CONSTBYTES 16U")] + public const uint crypto_core_hchacha20_CONSTBYTES = 16U; + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("size_t")] + public static extern nuint crypto_core_hsalsa20_outputbytes(); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("size_t")] + public static extern nuint crypto_core_hsalsa20_inputbytes(); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("size_t")] + public static extern nuint crypto_core_hsalsa20_keybytes(); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("size_t")] + public static extern nuint crypto_core_hsalsa20_constbytes(); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int crypto_core_hsalsa20([NativeTypeName("unsigned char *")] byte* @out, [NativeTypeName("const unsigned char *")] byte* @in, [NativeTypeName("const unsigned char *")] byte* k, [NativeTypeName("const unsigned char *")] byte* c); + + [NativeTypeName("#define crypto_core_hsalsa20_OUTPUTBYTES 32U")] + public const uint crypto_core_hsalsa20_OUTPUTBYTES = 32U; + + [NativeTypeName("#define crypto_core_hsalsa20_INPUTBYTES 16U")] + public const uint crypto_core_hsalsa20_INPUTBYTES = 16U; + + [NativeTypeName("#define crypto_core_hsalsa20_KEYBYTES 32U")] + public const uint crypto_core_hsalsa20_KEYBYTES = 32U; + + [NativeTypeName("#define crypto_core_hsalsa20_CONSTBYTES 16U")] + public const uint crypto_core_hsalsa20_CONSTBYTES = 16U; + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("size_t")] + public static extern nuint crypto_core_ristretto255_bytes(); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("size_t")] + public static extern nuint crypto_core_ristretto255_hashbytes(); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("size_t")] + public static extern nuint crypto_core_ristretto255_scalarbytes(); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("size_t")] + public static extern nuint crypto_core_ristretto255_nonreducedscalarbytes(); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int crypto_core_ristretto255_is_valid_point([NativeTypeName("const unsigned char *")] byte* p); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int crypto_core_ristretto255_add([NativeTypeName("unsigned char *")] byte* r, [NativeTypeName("const unsigned char *")] byte* p, [NativeTypeName("const unsigned char *")] byte* q); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int crypto_core_ristretto255_sub([NativeTypeName("unsigned char *")] byte* r, [NativeTypeName("const unsigned char *")] byte* p, [NativeTypeName("const unsigned char *")] byte* q); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int crypto_core_ristretto255_from_hash([NativeTypeName("unsigned char *")] byte* p, [NativeTypeName("const unsigned char *")] byte* r); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern void crypto_core_ristretto255_random([NativeTypeName("unsigned char *")] byte* p); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern void crypto_core_ristretto255_scalar_random([NativeTypeName("unsigned char *")] byte* r); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int crypto_core_ristretto255_scalar_invert([NativeTypeName("unsigned char *")] byte* recip, [NativeTypeName("const unsigned char *")] byte* s); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern void crypto_core_ristretto255_scalar_negate([NativeTypeName("unsigned char *")] byte* neg, [NativeTypeName("const unsigned char *")] byte* s); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern void crypto_core_ristretto255_scalar_complement([NativeTypeName("unsigned char *")] byte* comp, [NativeTypeName("const unsigned char *")] byte* s); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern void crypto_core_ristretto255_scalar_add([NativeTypeName("unsigned char *")] byte* z, [NativeTypeName("const unsigned char *")] byte* x, [NativeTypeName("const unsigned char *")] byte* y); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern void crypto_core_ristretto255_scalar_sub([NativeTypeName("unsigned char *")] byte* z, [NativeTypeName("const unsigned char *")] byte* x, [NativeTypeName("const unsigned char *")] byte* y); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern void crypto_core_ristretto255_scalar_mul([NativeTypeName("unsigned char *")] byte* z, [NativeTypeName("const unsigned char *")] byte* x, [NativeTypeName("const unsigned char *")] byte* y); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern void crypto_core_ristretto255_scalar_reduce([NativeTypeName("unsigned char *")] byte* r, [NativeTypeName("const unsigned char *")] byte* s); + + [NativeTypeName("#define crypto_core_ristretto255_BYTES 32")] + public const int crypto_core_ristretto255_BYTES = 32; + + [NativeTypeName("#define crypto_core_ristretto255_HASHBYTES 64")] + public const int crypto_core_ristretto255_HASHBYTES = 64; + + [NativeTypeName("#define crypto_core_ristretto255_SCALARBYTES 32")] + public const int crypto_core_ristretto255_SCALARBYTES = 32; + + [NativeTypeName("#define crypto_core_ristretto255_NONREDUCEDSCALARBYTES 64")] + public const int crypto_core_ristretto255_NONREDUCEDSCALARBYTES = 64; + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("size_t")] + public static extern nuint crypto_core_salsa20_outputbytes(); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("size_t")] + public static extern nuint crypto_core_salsa20_inputbytes(); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("size_t")] + public static extern nuint crypto_core_salsa20_keybytes(); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("size_t")] + public static extern nuint crypto_core_salsa20_constbytes(); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int crypto_core_salsa20([NativeTypeName("unsigned char *")] byte* @out, [NativeTypeName("const unsigned char *")] byte* @in, [NativeTypeName("const unsigned char *")] byte* k, [NativeTypeName("const unsigned char *")] byte* c); + + [NativeTypeName("#define crypto_core_salsa20_OUTPUTBYTES 64U")] + public const uint crypto_core_salsa20_OUTPUTBYTES = 64U; + + [NativeTypeName("#define crypto_core_salsa20_INPUTBYTES 16U")] + public const uint crypto_core_salsa20_INPUTBYTES = 16U; + + [NativeTypeName("#define crypto_core_salsa20_KEYBYTES 32U")] + public const uint crypto_core_salsa20_KEYBYTES = 32U; + + [NativeTypeName("#define crypto_core_salsa20_CONSTBYTES 16U")] + public const uint crypto_core_salsa20_CONSTBYTES = 16U; + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("size_t")] + [Obsolete] + public static extern nuint crypto_core_salsa208_outputbytes(); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("size_t")] + [Obsolete] + public static extern nuint crypto_core_salsa208_inputbytes(); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("size_t")] + [Obsolete] + public static extern nuint crypto_core_salsa208_keybytes(); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("size_t")] + [Obsolete] + public static extern nuint crypto_core_salsa208_constbytes(); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int crypto_core_salsa208([NativeTypeName("unsigned char *")] byte* @out, [NativeTypeName("const unsigned char *")] byte* @in, [NativeTypeName("const unsigned char *")] byte* k, [NativeTypeName("const unsigned char *")] byte* c); + + [NativeTypeName("#define crypto_core_salsa208_OUTPUTBYTES 64U")] + public const uint crypto_core_salsa208_OUTPUTBYTES = 64U; + + [NativeTypeName("#define crypto_core_salsa208_INPUTBYTES 16U")] + public const uint crypto_core_salsa208_INPUTBYTES = 16U; + + [NativeTypeName("#define crypto_core_salsa208_KEYBYTES 32U")] + public const uint crypto_core_salsa208_KEYBYTES = 32U; + + [NativeTypeName("#define crypto_core_salsa208_CONSTBYTES 16U")] + public const uint crypto_core_salsa208_CONSTBYTES = 16U; + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("size_t")] + public static extern nuint crypto_core_salsa2012_outputbytes(); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("size_t")] + public static extern nuint crypto_core_salsa2012_inputbytes(); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("size_t")] + public static extern nuint crypto_core_salsa2012_keybytes(); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("size_t")] + public static extern nuint crypto_core_salsa2012_constbytes(); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int crypto_core_salsa2012([NativeTypeName("unsigned char *")] byte* @out, [NativeTypeName("const unsigned char *")] byte* @in, [NativeTypeName("const unsigned char *")] byte* k, [NativeTypeName("const unsigned char *")] byte* c); + + [NativeTypeName("#define crypto_core_salsa2012_OUTPUTBYTES 64U")] + public const uint crypto_core_salsa2012_OUTPUTBYTES = 64U; + + [NativeTypeName("#define crypto_core_salsa2012_INPUTBYTES 16U")] + public const uint crypto_core_salsa2012_INPUTBYTES = 16U; + + [NativeTypeName("#define crypto_core_salsa2012_KEYBYTES 32U")] + public const uint crypto_core_salsa2012_KEYBYTES = 32U; + + [NativeTypeName("#define crypto_core_salsa2012_CONSTBYTES 16U")] + public const uint crypto_core_salsa2012_CONSTBYTES = 16U; + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("size_t")] + public static extern nuint crypto_generichash_bytes_min(); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("size_t")] + public static extern nuint crypto_generichash_bytes_max(); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("size_t")] + public static extern nuint crypto_generichash_bytes(); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("size_t")] + public static extern nuint crypto_generichash_keybytes_min(); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("size_t")] + public static extern nuint crypto_generichash_keybytes_max(); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("size_t")] + public static extern nuint crypto_generichash_keybytes(); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("const char *")] + public static extern sbyte* crypto_generichash_primitive(); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("size_t")] + public static extern nuint crypto_generichash_statebytes(); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int crypto_generichash([NativeTypeName("unsigned char *")] byte* @out, [NativeTypeName("size_t")] nuint outlen, [NativeTypeName("const unsigned char *")] byte* @in, [NativeTypeName("unsigned long long")] ulong inlen, [NativeTypeName("const unsigned char *")] byte* key, [NativeTypeName("size_t")] nuint keylen); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int crypto_generichash_init([NativeTypeName("crypto_generichash_state *")] crypto_generichash_blake2b_state* state, [NativeTypeName("const unsigned char *")] byte* key, [NativeTypeName("const size_t")] nuint keylen, [NativeTypeName("const size_t")] nuint outlen); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int crypto_generichash_update([NativeTypeName("crypto_generichash_state *")] crypto_generichash_blake2b_state* state, [NativeTypeName("const unsigned char *")] byte* @in, [NativeTypeName("unsigned long long")] ulong inlen); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int crypto_generichash_final([NativeTypeName("crypto_generichash_state *")] crypto_generichash_blake2b_state* state, [NativeTypeName("unsigned char *")] byte* @out, [NativeTypeName("const size_t")] nuint outlen); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern void crypto_generichash_keygen([NativeTypeName("unsigned char[32]")] byte* k); + + [NativeTypeName("#define crypto_generichash_BYTES_MIN crypto_generichash_blake2b_BYTES_MIN")] + public const uint crypto_generichash_BYTES_MIN = 16U; + + [NativeTypeName("#define crypto_generichash_BYTES_MAX crypto_generichash_blake2b_BYTES_MAX")] + public const uint crypto_generichash_BYTES_MAX = 64U; + + [NativeTypeName("#define crypto_generichash_BYTES crypto_generichash_blake2b_BYTES")] + public const uint crypto_generichash_BYTES = 32U; + + [NativeTypeName("#define crypto_generichash_KEYBYTES_MIN crypto_generichash_blake2b_KEYBYTES_MIN")] + public const uint crypto_generichash_KEYBYTES_MIN = 16U; + + [NativeTypeName("#define crypto_generichash_KEYBYTES_MAX crypto_generichash_blake2b_KEYBYTES_MAX")] + public const uint crypto_generichash_KEYBYTES_MAX = 64U; + + [NativeTypeName("#define crypto_generichash_KEYBYTES crypto_generichash_blake2b_KEYBYTES")] + public const uint crypto_generichash_KEYBYTES = 32U; + + [NativeTypeName("#define crypto_generichash_PRIMITIVE \"blake2b\"")] + public static ReadOnlySpan crypto_generichash_PRIMITIVE => "blake2b"u8; + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("size_t")] + public static extern nuint crypto_generichash_blake2b_bytes_min(); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("size_t")] + public static extern nuint crypto_generichash_blake2b_bytes_max(); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("size_t")] + public static extern nuint crypto_generichash_blake2b_bytes(); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("size_t")] + public static extern nuint crypto_generichash_blake2b_keybytes_min(); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("size_t")] + public static extern nuint crypto_generichash_blake2b_keybytes_max(); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("size_t")] + public static extern nuint crypto_generichash_blake2b_keybytes(); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("size_t")] + public static extern nuint crypto_generichash_blake2b_saltbytes(); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("size_t")] + public static extern nuint crypto_generichash_blake2b_personalbytes(); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("size_t")] + public static extern nuint crypto_generichash_blake2b_statebytes(); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int crypto_generichash_blake2b([NativeTypeName("unsigned char *")] byte* @out, [NativeTypeName("size_t")] nuint outlen, [NativeTypeName("const unsigned char *")] byte* @in, [NativeTypeName("unsigned long long")] ulong inlen, [NativeTypeName("const unsigned char *")] byte* key, [NativeTypeName("size_t")] nuint keylen); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int crypto_generichash_blake2b_salt_personal([NativeTypeName("unsigned char *")] byte* @out, [NativeTypeName("size_t")] nuint outlen, [NativeTypeName("const unsigned char *")] byte* @in, [NativeTypeName("unsigned long long")] ulong inlen, [NativeTypeName("const unsigned char *")] byte* key, [NativeTypeName("size_t")] nuint keylen, [NativeTypeName("const unsigned char *")] byte* salt, [NativeTypeName("const unsigned char *")] byte* personal); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int crypto_generichash_blake2b_init(crypto_generichash_blake2b_state* state, [NativeTypeName("const unsigned char *")] byte* key, [NativeTypeName("const size_t")] nuint keylen, [NativeTypeName("const size_t")] nuint outlen); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int crypto_generichash_blake2b_init_salt_personal(crypto_generichash_blake2b_state* state, [NativeTypeName("const unsigned char *")] byte* key, [NativeTypeName("const size_t")] nuint keylen, [NativeTypeName("const size_t")] nuint outlen, [NativeTypeName("const unsigned char *")] byte* salt, [NativeTypeName("const unsigned char *")] byte* personal); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int crypto_generichash_blake2b_update(crypto_generichash_blake2b_state* state, [NativeTypeName("const unsigned char *")] byte* @in, [NativeTypeName("unsigned long long")] ulong inlen); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int crypto_generichash_blake2b_final(crypto_generichash_blake2b_state* state, [NativeTypeName("unsigned char *")] byte* @out, [NativeTypeName("const size_t")] nuint outlen); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern void crypto_generichash_blake2b_keygen([NativeTypeName("unsigned char[32]")] byte* k); + + [NativeTypeName("#define crypto_generichash_blake2b_BYTES_MIN 16U")] + public const uint crypto_generichash_blake2b_BYTES_MIN = 16U; + + [NativeTypeName("#define crypto_generichash_blake2b_BYTES_MAX 64U")] + public const uint crypto_generichash_blake2b_BYTES_MAX = 64U; + + [NativeTypeName("#define crypto_generichash_blake2b_BYTES 32U")] + public const uint crypto_generichash_blake2b_BYTES = 32U; + + [NativeTypeName("#define crypto_generichash_blake2b_KEYBYTES_MIN 16U")] + public const uint crypto_generichash_blake2b_KEYBYTES_MIN = 16U; + + [NativeTypeName("#define crypto_generichash_blake2b_KEYBYTES_MAX 64U")] + public const uint crypto_generichash_blake2b_KEYBYTES_MAX = 64U; + + [NativeTypeName("#define crypto_generichash_blake2b_KEYBYTES 32U")] + public const uint crypto_generichash_blake2b_KEYBYTES = 32U; + + [NativeTypeName("#define crypto_generichash_blake2b_SALTBYTES 16U")] + public const uint crypto_generichash_blake2b_SALTBYTES = 16U; + + [NativeTypeName("#define crypto_generichash_blake2b_PERSONALBYTES 16U")] + public const uint crypto_generichash_blake2b_PERSONALBYTES = 16U; + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("size_t")] + public static extern nuint crypto_hash_bytes(); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int crypto_hash([NativeTypeName("unsigned char *")] byte* @out, [NativeTypeName("const unsigned char *")] byte* @in, [NativeTypeName("unsigned long long")] ulong inlen); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("const char *")] + public static extern sbyte* crypto_hash_primitive(); + + [NativeTypeName("#define crypto_hash_BYTES crypto_hash_sha512_BYTES")] + public const uint crypto_hash_BYTES = 64U; + + [NativeTypeName("#define crypto_hash_PRIMITIVE \"sha512\"")] + public static ReadOnlySpan crypto_hash_PRIMITIVE => "sha512"u8; + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("size_t")] + public static extern nuint crypto_hash_sha256_statebytes(); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("size_t")] + public static extern nuint crypto_hash_sha256_bytes(); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int crypto_hash_sha256([NativeTypeName("unsigned char *")] byte* @out, [NativeTypeName("const unsigned char *")] byte* @in, [NativeTypeName("unsigned long long")] ulong inlen); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int crypto_hash_sha256_init(crypto_hash_sha256_state* state); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int crypto_hash_sha256_update(crypto_hash_sha256_state* state, [NativeTypeName("const unsigned char *")] byte* @in, [NativeTypeName("unsigned long long")] ulong inlen); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int crypto_hash_sha256_final(crypto_hash_sha256_state* state, [NativeTypeName("unsigned char *")] byte* @out); + + [NativeTypeName("#define crypto_hash_sha256_BYTES 32U")] + public const uint crypto_hash_sha256_BYTES = 32U; + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("size_t")] + public static extern nuint crypto_hash_sha512_statebytes(); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("size_t")] + public static extern nuint crypto_hash_sha512_bytes(); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int crypto_hash_sha512([NativeTypeName("unsigned char *")] byte* @out, [NativeTypeName("const unsigned char *")] byte* @in, [NativeTypeName("unsigned long long")] ulong inlen); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int crypto_hash_sha512_init(crypto_hash_sha512_state* state); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int crypto_hash_sha512_update(crypto_hash_sha512_state* state, [NativeTypeName("const unsigned char *")] byte* @in, [NativeTypeName("unsigned long long")] ulong inlen); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int crypto_hash_sha512_final(crypto_hash_sha512_state* state, [NativeTypeName("unsigned char *")] byte* @out); + + [NativeTypeName("#define crypto_hash_sha512_BYTES 64U")] + public const uint crypto_hash_sha512_BYTES = 64U; + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("size_t")] + public static extern nuint crypto_kdf_bytes_min(); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("size_t")] + public static extern nuint crypto_kdf_bytes_max(); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("size_t")] + public static extern nuint crypto_kdf_contextbytes(); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("size_t")] + public static extern nuint crypto_kdf_keybytes(); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("const char *")] + public static extern sbyte* crypto_kdf_primitive(); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int crypto_kdf_derive_from_key([NativeTypeName("unsigned char *")] byte* subkey, [NativeTypeName("size_t")] nuint subkey_len, [NativeTypeName("uint64_t")] ulong subkey_id, [NativeTypeName("const char[8]")] sbyte* ctx, [NativeTypeName("const unsigned char[32]")] byte* key); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern void crypto_kdf_keygen([NativeTypeName("unsigned char[32]")] byte* k); + + [NativeTypeName("#define crypto_kdf_BYTES_MIN crypto_kdf_blake2b_BYTES_MIN")] + public const int crypto_kdf_BYTES_MIN = 16; + + [NativeTypeName("#define crypto_kdf_BYTES_MAX crypto_kdf_blake2b_BYTES_MAX")] + public const int crypto_kdf_BYTES_MAX = 64; + + [NativeTypeName("#define crypto_kdf_CONTEXTBYTES crypto_kdf_blake2b_CONTEXTBYTES")] + public const int crypto_kdf_CONTEXTBYTES = 8; + + [NativeTypeName("#define crypto_kdf_KEYBYTES crypto_kdf_blake2b_KEYBYTES")] + public const int crypto_kdf_KEYBYTES = 32; + + [NativeTypeName("#define crypto_kdf_PRIMITIVE \"blake2b\"")] + public static ReadOnlySpan crypto_kdf_PRIMITIVE => "blake2b"u8; + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("size_t")] + public static extern nuint crypto_kdf_blake2b_bytes_min(); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("size_t")] + public static extern nuint crypto_kdf_blake2b_bytes_max(); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("size_t")] + public static extern nuint crypto_kdf_blake2b_contextbytes(); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("size_t")] + public static extern nuint crypto_kdf_blake2b_keybytes(); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int crypto_kdf_blake2b_derive_from_key([NativeTypeName("unsigned char *")] byte* subkey, [NativeTypeName("size_t")] nuint subkey_len, [NativeTypeName("uint64_t")] ulong subkey_id, [NativeTypeName("const char[8]")] sbyte* ctx, [NativeTypeName("const unsigned char[32]")] byte* key); + + [NativeTypeName("#define crypto_kdf_blake2b_BYTES_MIN 16")] + public const int crypto_kdf_blake2b_BYTES_MIN = 16; + + [NativeTypeName("#define crypto_kdf_blake2b_BYTES_MAX 64")] + public const int crypto_kdf_blake2b_BYTES_MAX = 64; + + [NativeTypeName("#define crypto_kdf_blake2b_CONTEXTBYTES 8")] + public const int crypto_kdf_blake2b_CONTEXTBYTES = 8; + + [NativeTypeName("#define crypto_kdf_blake2b_KEYBYTES 32")] + public const int crypto_kdf_blake2b_KEYBYTES = 32; + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("size_t")] + public static extern nuint crypto_kx_publickeybytes(); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("size_t")] + public static extern nuint crypto_kx_secretkeybytes(); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("size_t")] + public static extern nuint crypto_kx_seedbytes(); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("size_t")] + public static extern nuint crypto_kx_sessionkeybytes(); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("const char *")] + public static extern sbyte* crypto_kx_primitive(); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int crypto_kx_seed_keypair([NativeTypeName("unsigned char[32]")] byte* pk, [NativeTypeName("unsigned char[32]")] byte* sk, [NativeTypeName("const unsigned char[32]")] byte* seed); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int crypto_kx_keypair([NativeTypeName("unsigned char[32]")] byte* pk, [NativeTypeName("unsigned char[32]")] byte* sk); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int crypto_kx_client_session_keys([NativeTypeName("unsigned char[32]")] byte* rx, [NativeTypeName("unsigned char[32]")] byte* tx, [NativeTypeName("const unsigned char[32]")] byte* client_pk, [NativeTypeName("const unsigned char[32]")] byte* client_sk, [NativeTypeName("const unsigned char[32]")] byte* server_pk); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int crypto_kx_server_session_keys([NativeTypeName("unsigned char[32]")] byte* rx, [NativeTypeName("unsigned char[32]")] byte* tx, [NativeTypeName("const unsigned char[32]")] byte* server_pk, [NativeTypeName("const unsigned char[32]")] byte* server_sk, [NativeTypeName("const unsigned char[32]")] byte* client_pk); + + [NativeTypeName("#define crypto_kx_PUBLICKEYBYTES 32")] + public const int crypto_kx_PUBLICKEYBYTES = 32; + + [NativeTypeName("#define crypto_kx_SECRETKEYBYTES 32")] + public const int crypto_kx_SECRETKEYBYTES = 32; + + [NativeTypeName("#define crypto_kx_SEEDBYTES 32")] + public const int crypto_kx_SEEDBYTES = 32; + + [NativeTypeName("#define crypto_kx_SESSIONKEYBYTES 32")] + public const int crypto_kx_SESSIONKEYBYTES = 32; + + [NativeTypeName("#define crypto_kx_PRIMITIVE \"x25519blake2b\"")] + public static ReadOnlySpan crypto_kx_PRIMITIVE => "x25519blake2b"u8; + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("size_t")] + public static extern nuint crypto_onetimeauth_statebytes(); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("size_t")] + public static extern nuint crypto_onetimeauth_bytes(); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("size_t")] + public static extern nuint crypto_onetimeauth_keybytes(); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("const char *")] + public static extern sbyte* crypto_onetimeauth_primitive(); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int crypto_onetimeauth([NativeTypeName("unsigned char *")] byte* @out, [NativeTypeName("const unsigned char *")] byte* @in, [NativeTypeName("unsigned long long")] ulong inlen, [NativeTypeName("const unsigned char *")] byte* k); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int crypto_onetimeauth_verify([NativeTypeName("const unsigned char *")] byte* h, [NativeTypeName("const unsigned char *")] byte* @in, [NativeTypeName("unsigned long long")] ulong inlen, [NativeTypeName("const unsigned char *")] byte* k); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int crypto_onetimeauth_init([NativeTypeName("crypto_onetimeauth_state *")] crypto_onetimeauth_poly1305_state* state, [NativeTypeName("const unsigned char *")] byte* key); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int crypto_onetimeauth_update([NativeTypeName("crypto_onetimeauth_state *")] crypto_onetimeauth_poly1305_state* state, [NativeTypeName("const unsigned char *")] byte* @in, [NativeTypeName("unsigned long long")] ulong inlen); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int crypto_onetimeauth_final([NativeTypeName("crypto_onetimeauth_state *")] crypto_onetimeauth_poly1305_state* state, [NativeTypeName("unsigned char *")] byte* @out); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern void crypto_onetimeauth_keygen([NativeTypeName("unsigned char[32]")] byte* k); + + [NativeTypeName("#define crypto_onetimeauth_BYTES crypto_onetimeauth_poly1305_BYTES")] + public const uint crypto_onetimeauth_BYTES = 16U; + + [NativeTypeName("#define crypto_onetimeauth_KEYBYTES crypto_onetimeauth_poly1305_KEYBYTES")] + public const uint crypto_onetimeauth_KEYBYTES = 32U; + + [NativeTypeName("#define crypto_onetimeauth_PRIMITIVE \"poly1305\"")] + public static ReadOnlySpan crypto_onetimeauth_PRIMITIVE => "poly1305"u8; + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("size_t")] + public static extern nuint crypto_onetimeauth_poly1305_statebytes(); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("size_t")] + public static extern nuint crypto_onetimeauth_poly1305_bytes(); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("size_t")] + public static extern nuint crypto_onetimeauth_poly1305_keybytes(); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int crypto_onetimeauth_poly1305([NativeTypeName("unsigned char *")] byte* @out, [NativeTypeName("const unsigned char *")] byte* @in, [NativeTypeName("unsigned long long")] ulong inlen, [NativeTypeName("const unsigned char *")] byte* k); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int crypto_onetimeauth_poly1305_verify([NativeTypeName("const unsigned char *")] byte* h, [NativeTypeName("const unsigned char *")] byte* @in, [NativeTypeName("unsigned long long")] ulong inlen, [NativeTypeName("const unsigned char *")] byte* k); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int crypto_onetimeauth_poly1305_init(crypto_onetimeauth_poly1305_state* state, [NativeTypeName("const unsigned char *")] byte* key); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int crypto_onetimeauth_poly1305_update(crypto_onetimeauth_poly1305_state* state, [NativeTypeName("const unsigned char *")] byte* @in, [NativeTypeName("unsigned long long")] ulong inlen); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int crypto_onetimeauth_poly1305_final(crypto_onetimeauth_poly1305_state* state, [NativeTypeName("unsigned char *")] byte* @out); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern void crypto_onetimeauth_poly1305_keygen([NativeTypeName("unsigned char[32]")] byte* k); + + [NativeTypeName("#define crypto_onetimeauth_poly1305_BYTES 16U")] + public const uint crypto_onetimeauth_poly1305_BYTES = 16U; + + [NativeTypeName("#define crypto_onetimeauth_poly1305_KEYBYTES 32U")] + public const uint crypto_onetimeauth_poly1305_KEYBYTES = 32U; + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int crypto_pwhash_alg_argon2i13(); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int crypto_pwhash_alg_argon2id13(); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int crypto_pwhash_alg_default(); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("size_t")] + public static extern nuint crypto_pwhash_bytes_min(); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("size_t")] + public static extern nuint crypto_pwhash_bytes_max(); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("size_t")] + public static extern nuint crypto_pwhash_passwd_min(); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("size_t")] + public static extern nuint crypto_pwhash_passwd_max(); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("size_t")] + public static extern nuint crypto_pwhash_saltbytes(); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("size_t")] + public static extern nuint crypto_pwhash_strbytes(); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("const char *")] + public static extern sbyte* crypto_pwhash_strprefix(); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("size_t")] + public static extern nuint crypto_pwhash_opslimit_min(); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("size_t")] + public static extern nuint crypto_pwhash_opslimit_max(); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("size_t")] + public static extern nuint crypto_pwhash_memlimit_min(); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("size_t")] + public static extern nuint crypto_pwhash_memlimit_max(); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("size_t")] + public static extern nuint crypto_pwhash_opslimit_interactive(); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("size_t")] + public static extern nuint crypto_pwhash_memlimit_interactive(); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("size_t")] + public static extern nuint crypto_pwhash_opslimit_moderate(); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("size_t")] + public static extern nuint crypto_pwhash_memlimit_moderate(); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("size_t")] + public static extern nuint crypto_pwhash_opslimit_sensitive(); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("size_t")] + public static extern nuint crypto_pwhash_memlimit_sensitive(); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int crypto_pwhash([NativeTypeName("unsigned char *const")] byte* @out, [NativeTypeName("unsigned long long")] ulong outlen, [NativeTypeName("const char *const")] sbyte* passwd, [NativeTypeName("unsigned long long")] ulong passwdlen, [NativeTypeName("const unsigned char *const")] byte* salt, [NativeTypeName("unsigned long long")] ulong opslimit, [NativeTypeName("size_t")] nuint memlimit, int alg); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int crypto_pwhash_str([NativeTypeName("char[128]")] sbyte* @out, [NativeTypeName("const char *const")] sbyte* passwd, [NativeTypeName("unsigned long long")] ulong passwdlen, [NativeTypeName("unsigned long long")] ulong opslimit, [NativeTypeName("size_t")] nuint memlimit); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int crypto_pwhash_str_alg([NativeTypeName("char[128]")] sbyte* @out, [NativeTypeName("const char *const")] sbyte* passwd, [NativeTypeName("unsigned long long")] ulong passwdlen, [NativeTypeName("unsigned long long")] ulong opslimit, [NativeTypeName("size_t")] nuint memlimit, int alg); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int crypto_pwhash_str_verify([NativeTypeName("const char *")] sbyte* str, [NativeTypeName("const char *const")] sbyte* passwd, [NativeTypeName("unsigned long long")] ulong passwdlen); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int crypto_pwhash_str_needs_rehash([NativeTypeName("const char *")] sbyte* str, [NativeTypeName("unsigned long long")] ulong opslimit, [NativeTypeName("size_t")] nuint memlimit); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("const char *")] + public static extern sbyte* crypto_pwhash_primitive(); + + [NativeTypeName("#define crypto_pwhash_ALG_ARGON2I13 crypto_pwhash_argon2i_ALG_ARGON2I13")] + public const int crypto_pwhash_ALG_ARGON2I13 = 1; + + [NativeTypeName("#define crypto_pwhash_ALG_ARGON2ID13 crypto_pwhash_argon2id_ALG_ARGON2ID13")] + public const int crypto_pwhash_ALG_ARGON2ID13 = 2; + + [NativeTypeName("#define crypto_pwhash_ALG_DEFAULT crypto_pwhash_ALG_ARGON2ID13")] + public const int crypto_pwhash_ALG_DEFAULT = 2; + + [NativeTypeName("#define crypto_pwhash_BYTES_MIN crypto_pwhash_argon2id_BYTES_MIN")] + public const uint crypto_pwhash_BYTES_MIN = 16U; + + [NativeTypeName("#define crypto_pwhash_BYTES_MAX crypto_pwhash_argon2id_BYTES_MAX")] + public const ulong crypto_pwhash_BYTES_MAX = ((((0xffffffffffffffffUL) < (0xffffffffffffffffUL) ? (0xffffffffffffffffUL) : (0xffffffffffffffffUL))) < (4294967295U) ? (((0xffffffffffffffffUL) < (0xffffffffffffffffUL) ? (0xffffffffffffffffUL) : (0xffffffffffffffffUL))) : (4294967295U)); + + [NativeTypeName("#define crypto_pwhash_PASSWD_MIN crypto_pwhash_argon2id_PASSWD_MIN")] + public const uint crypto_pwhash_PASSWD_MIN = 0U; + + [NativeTypeName("#define crypto_pwhash_PASSWD_MAX crypto_pwhash_argon2id_PASSWD_MAX")] + public const uint crypto_pwhash_PASSWD_MAX = 4294967295U; + + [NativeTypeName("#define crypto_pwhash_SALTBYTES crypto_pwhash_argon2id_SALTBYTES")] + public const uint crypto_pwhash_SALTBYTES = 16U; + + [NativeTypeName("#define crypto_pwhash_STRBYTES crypto_pwhash_argon2id_STRBYTES")] + public const uint crypto_pwhash_STRBYTES = 128U; + + [NativeTypeName("#define crypto_pwhash_STRPREFIX crypto_pwhash_argon2id_STRPREFIX")] + public static ReadOnlySpan crypto_pwhash_STRPREFIX => "$argon2id$"u8; + + [NativeTypeName("#define crypto_pwhash_OPSLIMIT_MIN crypto_pwhash_argon2id_OPSLIMIT_MIN")] + public const uint crypto_pwhash_OPSLIMIT_MIN = 1U; + + [NativeTypeName("#define crypto_pwhash_OPSLIMIT_MAX crypto_pwhash_argon2id_OPSLIMIT_MAX")] + public const uint crypto_pwhash_OPSLIMIT_MAX = 4294967295U; + + [NativeTypeName("#define crypto_pwhash_MEMLIMIT_MIN crypto_pwhash_argon2id_MEMLIMIT_MIN")] + public const uint crypto_pwhash_MEMLIMIT_MIN = 8192U; + + [NativeTypeName("#define crypto_pwhash_MEMLIMIT_MAX crypto_pwhash_argon2id_MEMLIMIT_MAX")] + public const ulong crypto_pwhash_MEMLIMIT_MAX = ((0xffffffffffffffffUL >= 4398046510080U) ? 4398046510080U : (0xffffffffffffffffUL >= 2147483648U) ? 2147483648U : 32768U); + + [NativeTypeName("#define crypto_pwhash_OPSLIMIT_INTERACTIVE crypto_pwhash_argon2id_OPSLIMIT_INTERACTIVE")] + public const uint crypto_pwhash_OPSLIMIT_INTERACTIVE = 2U; + + [NativeTypeName("#define crypto_pwhash_MEMLIMIT_INTERACTIVE crypto_pwhash_argon2id_MEMLIMIT_INTERACTIVE")] + public const uint crypto_pwhash_MEMLIMIT_INTERACTIVE = 67108864U; + + [NativeTypeName("#define crypto_pwhash_OPSLIMIT_MODERATE crypto_pwhash_argon2id_OPSLIMIT_MODERATE")] + public const uint crypto_pwhash_OPSLIMIT_MODERATE = 3U; + + [NativeTypeName("#define crypto_pwhash_MEMLIMIT_MODERATE crypto_pwhash_argon2id_MEMLIMIT_MODERATE")] + public const uint crypto_pwhash_MEMLIMIT_MODERATE = 268435456U; + + [NativeTypeName("#define crypto_pwhash_OPSLIMIT_SENSITIVE crypto_pwhash_argon2id_OPSLIMIT_SENSITIVE")] + public const uint crypto_pwhash_OPSLIMIT_SENSITIVE = 4U; + + [NativeTypeName("#define crypto_pwhash_MEMLIMIT_SENSITIVE crypto_pwhash_argon2id_MEMLIMIT_SENSITIVE")] + public const uint crypto_pwhash_MEMLIMIT_SENSITIVE = 1073741824U; + + [NativeTypeName("#define crypto_pwhash_PRIMITIVE \"argon2id,argon2i\"")] + public static ReadOnlySpan crypto_pwhash_PRIMITIVE => "argon2id,argon2i"u8; + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int crypto_pwhash_argon2i_alg_argon2i13(); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("size_t")] + public static extern nuint crypto_pwhash_argon2i_bytes_min(); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("size_t")] + public static extern nuint crypto_pwhash_argon2i_bytes_max(); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("size_t")] + public static extern nuint crypto_pwhash_argon2i_passwd_min(); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("size_t")] + public static extern nuint crypto_pwhash_argon2i_passwd_max(); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("size_t")] + public static extern nuint crypto_pwhash_argon2i_saltbytes(); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("size_t")] + public static extern nuint crypto_pwhash_argon2i_strbytes(); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("const char *")] + public static extern sbyte* crypto_pwhash_argon2i_strprefix(); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("size_t")] + public static extern nuint crypto_pwhash_argon2i_opslimit_min(); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("size_t")] + public static extern nuint crypto_pwhash_argon2i_opslimit_max(); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("size_t")] + public static extern nuint crypto_pwhash_argon2i_memlimit_min(); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("size_t")] + public static extern nuint crypto_pwhash_argon2i_memlimit_max(); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("size_t")] + public static extern nuint crypto_pwhash_argon2i_opslimit_interactive(); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("size_t")] + public static extern nuint crypto_pwhash_argon2i_memlimit_interactive(); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("size_t")] + public static extern nuint crypto_pwhash_argon2i_opslimit_moderate(); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("size_t")] + public static extern nuint crypto_pwhash_argon2i_memlimit_moderate(); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("size_t")] + public static extern nuint crypto_pwhash_argon2i_opslimit_sensitive(); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("size_t")] + public static extern nuint crypto_pwhash_argon2i_memlimit_sensitive(); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int crypto_pwhash_argon2i([NativeTypeName("unsigned char *const")] byte* @out, [NativeTypeName("unsigned long long")] ulong outlen, [NativeTypeName("const char *const")] sbyte* passwd, [NativeTypeName("unsigned long long")] ulong passwdlen, [NativeTypeName("const unsigned char *const")] byte* salt, [NativeTypeName("unsigned long long")] ulong opslimit, [NativeTypeName("size_t")] nuint memlimit, int alg); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int crypto_pwhash_argon2i_str([NativeTypeName("char[128]")] sbyte* @out, [NativeTypeName("const char *const")] sbyte* passwd, [NativeTypeName("unsigned long long")] ulong passwdlen, [NativeTypeName("unsigned long long")] ulong opslimit, [NativeTypeName("size_t")] nuint memlimit); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int crypto_pwhash_argon2i_str_verify([NativeTypeName("const char *")] sbyte* str, [NativeTypeName("const char *const")] sbyte* passwd, [NativeTypeName("unsigned long long")] ulong passwdlen); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int crypto_pwhash_argon2i_str_needs_rehash([NativeTypeName("const char *")] sbyte* str, [NativeTypeName("unsigned long long")] ulong opslimit, [NativeTypeName("size_t")] nuint memlimit); + + [NativeTypeName("#define crypto_pwhash_argon2i_ALG_ARGON2I13 1")] + public const int crypto_pwhash_argon2i_ALG_ARGON2I13 = 1; + + [NativeTypeName("#define crypto_pwhash_argon2i_BYTES_MIN 16U")] + public const uint crypto_pwhash_argon2i_BYTES_MIN = 16U; + + [NativeTypeName("#define crypto_pwhash_argon2i_BYTES_MAX SODIUM_MIN(SODIUM_SIZE_MAX, 4294967295U)")] + public const ulong crypto_pwhash_argon2i_BYTES_MAX = ((((0xffffffffffffffffUL) < (0xffffffffffffffffUL) ? (0xffffffffffffffffUL) : (0xffffffffffffffffUL))) < (4294967295U) ? (((0xffffffffffffffffUL) < (0xffffffffffffffffUL) ? (0xffffffffffffffffUL) : (0xffffffffffffffffUL))) : (4294967295U)); + + [NativeTypeName("#define crypto_pwhash_argon2i_PASSWD_MIN 0U")] + public const uint crypto_pwhash_argon2i_PASSWD_MIN = 0U; + + [NativeTypeName("#define crypto_pwhash_argon2i_PASSWD_MAX 4294967295U")] + public const uint crypto_pwhash_argon2i_PASSWD_MAX = 4294967295U; + + [NativeTypeName("#define crypto_pwhash_argon2i_SALTBYTES 16U")] + public const uint crypto_pwhash_argon2i_SALTBYTES = 16U; + + [NativeTypeName("#define crypto_pwhash_argon2i_STRBYTES 128U")] + public const uint crypto_pwhash_argon2i_STRBYTES = 128U; + + [NativeTypeName("#define crypto_pwhash_argon2i_STRPREFIX \"$argon2i$\"")] + public static ReadOnlySpan crypto_pwhash_argon2i_STRPREFIX => "$argon2i$"u8; + + [NativeTypeName("#define crypto_pwhash_argon2i_OPSLIMIT_MIN 3U")] + public const uint crypto_pwhash_argon2i_OPSLIMIT_MIN = 3U; + + [NativeTypeName("#define crypto_pwhash_argon2i_OPSLIMIT_MAX 4294967295U")] + public const uint crypto_pwhash_argon2i_OPSLIMIT_MAX = 4294967295U; + + [NativeTypeName("#define crypto_pwhash_argon2i_MEMLIMIT_MIN 8192U")] + public const uint crypto_pwhash_argon2i_MEMLIMIT_MIN = 8192U; + + [NativeTypeName("#define crypto_pwhash_argon2i_MEMLIMIT_MAX ((SIZE_MAX >= 4398046510080U) ? 4398046510080U : (SIZE_MAX >= 2147483648U) ? 2147483648U : 32768U)")] + public const ulong crypto_pwhash_argon2i_MEMLIMIT_MAX = ((0xffffffffffffffffUL >= 4398046510080U) ? 4398046510080U : (0xffffffffffffffffUL >= 2147483648U) ? 2147483648U : 32768U); + + [NativeTypeName("#define crypto_pwhash_argon2i_OPSLIMIT_INTERACTIVE 4U")] + public const uint crypto_pwhash_argon2i_OPSLIMIT_INTERACTIVE = 4U; + + [NativeTypeName("#define crypto_pwhash_argon2i_MEMLIMIT_INTERACTIVE 33554432U")] + public const uint crypto_pwhash_argon2i_MEMLIMIT_INTERACTIVE = 33554432U; + + [NativeTypeName("#define crypto_pwhash_argon2i_OPSLIMIT_MODERATE 6U")] + public const uint crypto_pwhash_argon2i_OPSLIMIT_MODERATE = 6U; + + [NativeTypeName("#define crypto_pwhash_argon2i_MEMLIMIT_MODERATE 134217728U")] + public const uint crypto_pwhash_argon2i_MEMLIMIT_MODERATE = 134217728U; + + [NativeTypeName("#define crypto_pwhash_argon2i_OPSLIMIT_SENSITIVE 8U")] + public const uint crypto_pwhash_argon2i_OPSLIMIT_SENSITIVE = 8U; + + [NativeTypeName("#define crypto_pwhash_argon2i_MEMLIMIT_SENSITIVE 536870912U")] + public const uint crypto_pwhash_argon2i_MEMLIMIT_SENSITIVE = 536870912U; + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int crypto_pwhash_argon2id_alg_argon2id13(); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("size_t")] + public static extern nuint crypto_pwhash_argon2id_bytes_min(); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("size_t")] + public static extern nuint crypto_pwhash_argon2id_bytes_max(); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("size_t")] + public static extern nuint crypto_pwhash_argon2id_passwd_min(); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("size_t")] + public static extern nuint crypto_pwhash_argon2id_passwd_max(); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("size_t")] + public static extern nuint crypto_pwhash_argon2id_saltbytes(); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("size_t")] + public static extern nuint crypto_pwhash_argon2id_strbytes(); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("const char *")] + public static extern sbyte* crypto_pwhash_argon2id_strprefix(); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("size_t")] + public static extern nuint crypto_pwhash_argon2id_opslimit_min(); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("size_t")] + public static extern nuint crypto_pwhash_argon2id_opslimit_max(); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("size_t")] + public static extern nuint crypto_pwhash_argon2id_memlimit_min(); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("size_t")] + public static extern nuint crypto_pwhash_argon2id_memlimit_max(); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("size_t")] + public static extern nuint crypto_pwhash_argon2id_opslimit_interactive(); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("size_t")] + public static extern nuint crypto_pwhash_argon2id_memlimit_interactive(); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("size_t")] + public static extern nuint crypto_pwhash_argon2id_opslimit_moderate(); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("size_t")] + public static extern nuint crypto_pwhash_argon2id_memlimit_moderate(); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("size_t")] + public static extern nuint crypto_pwhash_argon2id_opslimit_sensitive(); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("size_t")] + public static extern nuint crypto_pwhash_argon2id_memlimit_sensitive(); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int crypto_pwhash_argon2id([NativeTypeName("unsigned char *const")] byte* @out, [NativeTypeName("unsigned long long")] ulong outlen, [NativeTypeName("const char *const")] sbyte* passwd, [NativeTypeName("unsigned long long")] ulong passwdlen, [NativeTypeName("const unsigned char *const")] byte* salt, [NativeTypeName("unsigned long long")] ulong opslimit, [NativeTypeName("size_t")] nuint memlimit, int alg); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int crypto_pwhash_argon2id_str([NativeTypeName("char[128]")] sbyte* @out, [NativeTypeName("const char *const")] sbyte* passwd, [NativeTypeName("unsigned long long")] ulong passwdlen, [NativeTypeName("unsigned long long")] ulong opslimit, [NativeTypeName("size_t")] nuint memlimit); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int crypto_pwhash_argon2id_str_verify([NativeTypeName("const char *")] sbyte* str, [NativeTypeName("const char *const")] sbyte* passwd, [NativeTypeName("unsigned long long")] ulong passwdlen); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int crypto_pwhash_argon2id_str_needs_rehash([NativeTypeName("const char *")] sbyte* str, [NativeTypeName("unsigned long long")] ulong opslimit, [NativeTypeName("size_t")] nuint memlimit); + + [NativeTypeName("#define crypto_pwhash_argon2id_ALG_ARGON2ID13 2")] + public const int crypto_pwhash_argon2id_ALG_ARGON2ID13 = 2; + + [NativeTypeName("#define crypto_pwhash_argon2id_BYTES_MIN 16U")] + public const uint crypto_pwhash_argon2id_BYTES_MIN = 16U; + + [NativeTypeName("#define crypto_pwhash_argon2id_BYTES_MAX SODIUM_MIN(SODIUM_SIZE_MAX, 4294967295U)")] + public const ulong crypto_pwhash_argon2id_BYTES_MAX = ((((0xffffffffffffffffUL) < (0xffffffffffffffffUL) ? (0xffffffffffffffffUL) : (0xffffffffffffffffUL))) < (4294967295U) ? (((0xffffffffffffffffUL) < (0xffffffffffffffffUL) ? (0xffffffffffffffffUL) : (0xffffffffffffffffUL))) : (4294967295U)); + + [NativeTypeName("#define crypto_pwhash_argon2id_PASSWD_MIN 0U")] + public const uint crypto_pwhash_argon2id_PASSWD_MIN = 0U; + + [NativeTypeName("#define crypto_pwhash_argon2id_PASSWD_MAX 4294967295U")] + public const uint crypto_pwhash_argon2id_PASSWD_MAX = 4294967295U; + + [NativeTypeName("#define crypto_pwhash_argon2id_SALTBYTES 16U")] + public const uint crypto_pwhash_argon2id_SALTBYTES = 16U; + + [NativeTypeName("#define crypto_pwhash_argon2id_STRBYTES 128U")] + public const uint crypto_pwhash_argon2id_STRBYTES = 128U; + + [NativeTypeName("#define crypto_pwhash_argon2id_STRPREFIX \"$argon2id$\"")] + public static ReadOnlySpan crypto_pwhash_argon2id_STRPREFIX => "$argon2id$"u8; + + [NativeTypeName("#define crypto_pwhash_argon2id_OPSLIMIT_MIN 1U")] + public const uint crypto_pwhash_argon2id_OPSLIMIT_MIN = 1U; + + [NativeTypeName("#define crypto_pwhash_argon2id_OPSLIMIT_MAX 4294967295U")] + public const uint crypto_pwhash_argon2id_OPSLIMIT_MAX = 4294967295U; + + [NativeTypeName("#define crypto_pwhash_argon2id_MEMLIMIT_MIN 8192U")] + public const uint crypto_pwhash_argon2id_MEMLIMIT_MIN = 8192U; + + [NativeTypeName("#define crypto_pwhash_argon2id_MEMLIMIT_MAX ((SIZE_MAX >= 4398046510080U) ? 4398046510080U : (SIZE_MAX >= 2147483648U) ? 2147483648U : 32768U)")] + public const ulong crypto_pwhash_argon2id_MEMLIMIT_MAX = ((0xffffffffffffffffUL >= 4398046510080U) ? 4398046510080U : (0xffffffffffffffffUL >= 2147483648U) ? 2147483648U : 32768U); + + [NativeTypeName("#define crypto_pwhash_argon2id_OPSLIMIT_INTERACTIVE 2U")] + public const uint crypto_pwhash_argon2id_OPSLIMIT_INTERACTIVE = 2U; + + [NativeTypeName("#define crypto_pwhash_argon2id_MEMLIMIT_INTERACTIVE 67108864U")] + public const uint crypto_pwhash_argon2id_MEMLIMIT_INTERACTIVE = 67108864U; + + [NativeTypeName("#define crypto_pwhash_argon2id_OPSLIMIT_MODERATE 3U")] + public const uint crypto_pwhash_argon2id_OPSLIMIT_MODERATE = 3U; + + [NativeTypeName("#define crypto_pwhash_argon2id_MEMLIMIT_MODERATE 268435456U")] + public const uint crypto_pwhash_argon2id_MEMLIMIT_MODERATE = 268435456U; + + [NativeTypeName("#define crypto_pwhash_argon2id_OPSLIMIT_SENSITIVE 4U")] + public const uint crypto_pwhash_argon2id_OPSLIMIT_SENSITIVE = 4U; + + [NativeTypeName("#define crypto_pwhash_argon2id_MEMLIMIT_SENSITIVE 1073741824U")] + public const uint crypto_pwhash_argon2id_MEMLIMIT_SENSITIVE = 1073741824U; + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("size_t")] + public static extern nuint crypto_pwhash_scryptsalsa208sha256_bytes_min(); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("size_t")] + public static extern nuint crypto_pwhash_scryptsalsa208sha256_bytes_max(); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("size_t")] + public static extern nuint crypto_pwhash_scryptsalsa208sha256_passwd_min(); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("size_t")] + public static extern nuint crypto_pwhash_scryptsalsa208sha256_passwd_max(); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("size_t")] + public static extern nuint crypto_pwhash_scryptsalsa208sha256_saltbytes(); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("size_t")] + public static extern nuint crypto_pwhash_scryptsalsa208sha256_strbytes(); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("const char *")] + public static extern sbyte* crypto_pwhash_scryptsalsa208sha256_strprefix(); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("size_t")] + public static extern nuint crypto_pwhash_scryptsalsa208sha256_opslimit_min(); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("size_t")] + public static extern nuint crypto_pwhash_scryptsalsa208sha256_opslimit_max(); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("size_t")] + public static extern nuint crypto_pwhash_scryptsalsa208sha256_memlimit_min(); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("size_t")] + public static extern nuint crypto_pwhash_scryptsalsa208sha256_memlimit_max(); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("size_t")] + public static extern nuint crypto_pwhash_scryptsalsa208sha256_opslimit_interactive(); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("size_t")] + public static extern nuint crypto_pwhash_scryptsalsa208sha256_memlimit_interactive(); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("size_t")] + public static extern nuint crypto_pwhash_scryptsalsa208sha256_opslimit_sensitive(); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("size_t")] + public static extern nuint crypto_pwhash_scryptsalsa208sha256_memlimit_sensitive(); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int crypto_pwhash_scryptsalsa208sha256([NativeTypeName("unsigned char *const")] byte* @out, [NativeTypeName("unsigned long long")] ulong outlen, [NativeTypeName("const char *const")] sbyte* passwd, [NativeTypeName("unsigned long long")] ulong passwdlen, [NativeTypeName("const unsigned char *const")] byte* salt, [NativeTypeName("unsigned long long")] ulong opslimit, [NativeTypeName("size_t")] nuint memlimit); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int crypto_pwhash_scryptsalsa208sha256_str([NativeTypeName("char[102]")] sbyte* @out, [NativeTypeName("const char *const")] sbyte* passwd, [NativeTypeName("unsigned long long")] ulong passwdlen, [NativeTypeName("unsigned long long")] ulong opslimit, [NativeTypeName("size_t")] nuint memlimit); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int crypto_pwhash_scryptsalsa208sha256_str_verify([NativeTypeName("const char *")] sbyte* str, [NativeTypeName("const char *const")] sbyte* passwd, [NativeTypeName("unsigned long long")] ulong passwdlen); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int crypto_pwhash_scryptsalsa208sha256_ll([NativeTypeName("const uint8_t *")] byte* passwd, [NativeTypeName("size_t")] nuint passwdlen, [NativeTypeName("const uint8_t *")] byte* salt, [NativeTypeName("size_t")] nuint saltlen, [NativeTypeName("uint64_t")] ulong N, [NativeTypeName("uint32_t")] uint r, [NativeTypeName("uint32_t")] uint p, [NativeTypeName("uint8_t *")] byte* buf, [NativeTypeName("size_t")] nuint buflen); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int crypto_pwhash_scryptsalsa208sha256_str_needs_rehash([NativeTypeName("const char *")] sbyte* str, [NativeTypeName("unsigned long long")] ulong opslimit, [NativeTypeName("size_t")] nuint memlimit); + + [NativeTypeName("#define crypto_pwhash_scryptsalsa208sha256_BYTES_MIN 16U")] + public const uint crypto_pwhash_scryptsalsa208sha256_BYTES_MIN = 16U; + + [NativeTypeName("#define crypto_pwhash_scryptsalsa208sha256_BYTES_MAX SODIUM_MIN(SODIUM_SIZE_MAX, 0x1fffffffe0ULL)")] + public const ulong crypto_pwhash_scryptsalsa208sha256_BYTES_MAX = ((((0xffffffffffffffffUL) < (0xffffffffffffffffUL) ? (0xffffffffffffffffUL) : (0xffffffffffffffffUL))) < (0x1fffffffe0UL) ? (((0xffffffffffffffffUL) < (0xffffffffffffffffUL) ? (0xffffffffffffffffUL) : (0xffffffffffffffffUL))) : (0x1fffffffe0UL)); + + [NativeTypeName("#define crypto_pwhash_scryptsalsa208sha256_PASSWD_MIN 0U")] + public const uint crypto_pwhash_scryptsalsa208sha256_PASSWD_MIN = 0U; + + [NativeTypeName("#define crypto_pwhash_scryptsalsa208sha256_PASSWD_MAX SODIUM_SIZE_MAX")] + public const ulong crypto_pwhash_scryptsalsa208sha256_PASSWD_MAX = ((0xffffffffffffffffUL) < (0xffffffffffffffffUL) ? (0xffffffffffffffffUL) : (0xffffffffffffffffUL)); + + [NativeTypeName("#define crypto_pwhash_scryptsalsa208sha256_SALTBYTES 32U")] + public const uint crypto_pwhash_scryptsalsa208sha256_SALTBYTES = 32U; + + [NativeTypeName("#define crypto_pwhash_scryptsalsa208sha256_STRBYTES 102U")] + public const uint crypto_pwhash_scryptsalsa208sha256_STRBYTES = 102U; + + [NativeTypeName("#define crypto_pwhash_scryptsalsa208sha256_STRPREFIX \"$7$\"")] + public static ReadOnlySpan crypto_pwhash_scryptsalsa208sha256_STRPREFIX => "$7$"u8; + + [NativeTypeName("#define crypto_pwhash_scryptsalsa208sha256_OPSLIMIT_MIN 32768U")] + public const uint crypto_pwhash_scryptsalsa208sha256_OPSLIMIT_MIN = 32768U; + + [NativeTypeName("#define crypto_pwhash_scryptsalsa208sha256_OPSLIMIT_MAX 4294967295U")] + public const uint crypto_pwhash_scryptsalsa208sha256_OPSLIMIT_MAX = 4294967295U; + + [NativeTypeName("#define crypto_pwhash_scryptsalsa208sha256_MEMLIMIT_MIN 16777216U")] + public const uint crypto_pwhash_scryptsalsa208sha256_MEMLIMIT_MIN = 16777216U; + + [NativeTypeName("#define crypto_pwhash_scryptsalsa208sha256_MEMLIMIT_MAX SODIUM_MIN(SIZE_MAX, 68719476736ULL)")] + public const ulong crypto_pwhash_scryptsalsa208sha256_MEMLIMIT_MAX = ((0xffffffffffffffffUL) < (68719476736UL) ? (0xffffffffffffffffUL) : (68719476736UL)); + + [NativeTypeName("#define crypto_pwhash_scryptsalsa208sha256_OPSLIMIT_INTERACTIVE 524288U")] + public const uint crypto_pwhash_scryptsalsa208sha256_OPSLIMIT_INTERACTIVE = 524288U; + + [NativeTypeName("#define crypto_pwhash_scryptsalsa208sha256_MEMLIMIT_INTERACTIVE 16777216U")] + public const uint crypto_pwhash_scryptsalsa208sha256_MEMLIMIT_INTERACTIVE = 16777216U; + + [NativeTypeName("#define crypto_pwhash_scryptsalsa208sha256_OPSLIMIT_SENSITIVE 33554432U")] + public const uint crypto_pwhash_scryptsalsa208sha256_OPSLIMIT_SENSITIVE = 33554432U; + + [NativeTypeName("#define crypto_pwhash_scryptsalsa208sha256_MEMLIMIT_SENSITIVE 1073741824U")] + public const uint crypto_pwhash_scryptsalsa208sha256_MEMLIMIT_SENSITIVE = 1073741824U; + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("size_t")] + public static extern nuint crypto_scalarmult_bytes(); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("size_t")] + public static extern nuint crypto_scalarmult_scalarbytes(); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("const char *")] + public static extern sbyte* crypto_scalarmult_primitive(); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int crypto_scalarmult_base([NativeTypeName("unsigned char *")] byte* q, [NativeTypeName("const unsigned char *")] byte* n); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int crypto_scalarmult([NativeTypeName("unsigned char *")] byte* q, [NativeTypeName("const unsigned char *")] byte* n, [NativeTypeName("const unsigned char *")] byte* p); + + [NativeTypeName("#define crypto_scalarmult_BYTES crypto_scalarmult_curve25519_BYTES")] + public const uint crypto_scalarmult_BYTES = 32U; + + [NativeTypeName("#define crypto_scalarmult_SCALARBYTES crypto_scalarmult_curve25519_SCALARBYTES")] + public const uint crypto_scalarmult_SCALARBYTES = 32U; + + [NativeTypeName("#define crypto_scalarmult_PRIMITIVE \"curve25519\"")] + public static ReadOnlySpan crypto_scalarmult_PRIMITIVE => "curve25519"u8; + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("size_t")] + public static extern nuint crypto_scalarmult_curve25519_bytes(); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("size_t")] + public static extern nuint crypto_scalarmult_curve25519_scalarbytes(); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int crypto_scalarmult_curve25519([NativeTypeName("unsigned char *")] byte* q, [NativeTypeName("const unsigned char *")] byte* n, [NativeTypeName("const unsigned char *")] byte* p); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int crypto_scalarmult_curve25519_base([NativeTypeName("unsigned char *")] byte* q, [NativeTypeName("const unsigned char *")] byte* n); + + [NativeTypeName("#define crypto_scalarmult_curve25519_BYTES 32U")] + public const uint crypto_scalarmult_curve25519_BYTES = 32U; + + [NativeTypeName("#define crypto_scalarmult_curve25519_SCALARBYTES 32U")] + public const uint crypto_scalarmult_curve25519_SCALARBYTES = 32U; + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("size_t")] + public static extern nuint crypto_scalarmult_ed25519_bytes(); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("size_t")] + public static extern nuint crypto_scalarmult_ed25519_scalarbytes(); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int crypto_scalarmult_ed25519([NativeTypeName("unsigned char *")] byte* q, [NativeTypeName("const unsigned char *")] byte* n, [NativeTypeName("const unsigned char *")] byte* p); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int crypto_scalarmult_ed25519_noclamp([NativeTypeName("unsigned char *")] byte* q, [NativeTypeName("const unsigned char *")] byte* n, [NativeTypeName("const unsigned char *")] byte* p); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int crypto_scalarmult_ed25519_base([NativeTypeName("unsigned char *")] byte* q, [NativeTypeName("const unsigned char *")] byte* n); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int crypto_scalarmult_ed25519_base_noclamp([NativeTypeName("unsigned char *")] byte* q, [NativeTypeName("const unsigned char *")] byte* n); + + [NativeTypeName("#define crypto_scalarmult_ed25519_BYTES 32U")] + public const uint crypto_scalarmult_ed25519_BYTES = 32U; + + [NativeTypeName("#define crypto_scalarmult_ed25519_SCALARBYTES 32U")] + public const uint crypto_scalarmult_ed25519_SCALARBYTES = 32U; + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("size_t")] + public static extern nuint crypto_scalarmult_ristretto255_bytes(); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("size_t")] + public static extern nuint crypto_scalarmult_ristretto255_scalarbytes(); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int crypto_scalarmult_ristretto255([NativeTypeName("unsigned char *")] byte* q, [NativeTypeName("const unsigned char *")] byte* n, [NativeTypeName("const unsigned char *")] byte* p); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int crypto_scalarmult_ristretto255_base([NativeTypeName("unsigned char *")] byte* q, [NativeTypeName("const unsigned char *")] byte* n); + + [NativeTypeName("#define crypto_scalarmult_ristretto255_BYTES 32U")] + public const uint crypto_scalarmult_ristretto255_BYTES = 32U; + + [NativeTypeName("#define crypto_scalarmult_ristretto255_SCALARBYTES 32U")] + public const uint crypto_scalarmult_ristretto255_SCALARBYTES = 32U; + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("size_t")] + public static extern nuint crypto_secretbox_keybytes(); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("size_t")] + public static extern nuint crypto_secretbox_noncebytes(); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("size_t")] + public static extern nuint crypto_secretbox_macbytes(); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("const char *")] + public static extern sbyte* crypto_secretbox_primitive(); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("size_t")] + public static extern nuint crypto_secretbox_messagebytes_max(); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int crypto_secretbox_easy([NativeTypeName("unsigned char *")] byte* c, [NativeTypeName("const unsigned char *")] byte* m, [NativeTypeName("unsigned long long")] ulong mlen, [NativeTypeName("const unsigned char *")] byte* n, [NativeTypeName("const unsigned char *")] byte* k); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int crypto_secretbox_open_easy([NativeTypeName("unsigned char *")] byte* m, [NativeTypeName("const unsigned char *")] byte* c, [NativeTypeName("unsigned long long")] ulong clen, [NativeTypeName("const unsigned char *")] byte* n, [NativeTypeName("const unsigned char *")] byte* k); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int crypto_secretbox_detached([NativeTypeName("unsigned char *")] byte* c, [NativeTypeName("unsigned char *")] byte* mac, [NativeTypeName("const unsigned char *")] byte* m, [NativeTypeName("unsigned long long")] ulong mlen, [NativeTypeName("const unsigned char *")] byte* n, [NativeTypeName("const unsigned char *")] byte* k); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int crypto_secretbox_open_detached([NativeTypeName("unsigned char *")] byte* m, [NativeTypeName("const unsigned char *")] byte* c, [NativeTypeName("const unsigned char *")] byte* mac, [NativeTypeName("unsigned long long")] ulong clen, [NativeTypeName("const unsigned char *")] byte* n, [NativeTypeName("const unsigned char *")] byte* k); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern void crypto_secretbox_keygen([NativeTypeName("unsigned char[32]")] byte* k); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("size_t")] + public static extern nuint crypto_secretbox_zerobytes(); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("size_t")] + public static extern nuint crypto_secretbox_boxzerobytes(); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int crypto_secretbox([NativeTypeName("unsigned char *")] byte* c, [NativeTypeName("const unsigned char *")] byte* m, [NativeTypeName("unsigned long long")] ulong mlen, [NativeTypeName("const unsigned char *")] byte* n, [NativeTypeName("const unsigned char *")] byte* k); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int crypto_secretbox_open([NativeTypeName("unsigned char *")] byte* m, [NativeTypeName("const unsigned char *")] byte* c, [NativeTypeName("unsigned long long")] ulong clen, [NativeTypeName("const unsigned char *")] byte* n, [NativeTypeName("const unsigned char *")] byte* k); + + [NativeTypeName("#define crypto_secretbox_KEYBYTES crypto_secretbox_xsalsa20poly1305_KEYBYTES")] + public const uint crypto_secretbox_KEYBYTES = 32U; + + [NativeTypeName("#define crypto_secretbox_NONCEBYTES crypto_secretbox_xsalsa20poly1305_NONCEBYTES")] + public const uint crypto_secretbox_NONCEBYTES = 24U; + + [NativeTypeName("#define crypto_secretbox_MACBYTES crypto_secretbox_xsalsa20poly1305_MACBYTES")] + public const uint crypto_secretbox_MACBYTES = 16U; + + [NativeTypeName("#define crypto_secretbox_PRIMITIVE \"xsalsa20poly1305\"")] + public static ReadOnlySpan crypto_secretbox_PRIMITIVE => "xsalsa20poly1305"u8; + + [NativeTypeName("#define crypto_secretbox_MESSAGEBYTES_MAX crypto_secretbox_xsalsa20poly1305_MESSAGEBYTES_MAX")] + public const ulong crypto_secretbox_MESSAGEBYTES_MAX = (((0xffffffffffffffffUL) < (0xffffffffffffffffUL) ? (0xffffffffffffffffUL) : (0xffffffffffffffffUL)) - 16U); + + [NativeTypeName("#define crypto_secretbox_ZEROBYTES crypto_secretbox_xsalsa20poly1305_ZEROBYTES")] + public const uint crypto_secretbox_ZEROBYTES = (16U + 16U); + + [NativeTypeName("#define crypto_secretbox_BOXZEROBYTES crypto_secretbox_xsalsa20poly1305_BOXZEROBYTES")] + public const uint crypto_secretbox_BOXZEROBYTES = 16U; + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("size_t")] + public static extern nuint crypto_secretbox_xchacha20poly1305_keybytes(); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("size_t")] + public static extern nuint crypto_secretbox_xchacha20poly1305_noncebytes(); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("size_t")] + public static extern nuint crypto_secretbox_xchacha20poly1305_macbytes(); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("size_t")] + public static extern nuint crypto_secretbox_xchacha20poly1305_messagebytes_max(); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int crypto_secretbox_xchacha20poly1305_easy([NativeTypeName("unsigned char *")] byte* c, [NativeTypeName("const unsigned char *")] byte* m, [NativeTypeName("unsigned long long")] ulong mlen, [NativeTypeName("const unsigned char *")] byte* n, [NativeTypeName("const unsigned char *")] byte* k); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int crypto_secretbox_xchacha20poly1305_open_easy([NativeTypeName("unsigned char *")] byte* m, [NativeTypeName("const unsigned char *")] byte* c, [NativeTypeName("unsigned long long")] ulong clen, [NativeTypeName("const unsigned char *")] byte* n, [NativeTypeName("const unsigned char *")] byte* k); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int crypto_secretbox_xchacha20poly1305_detached([NativeTypeName("unsigned char *")] byte* c, [NativeTypeName("unsigned char *")] byte* mac, [NativeTypeName("const unsigned char *")] byte* m, [NativeTypeName("unsigned long long")] ulong mlen, [NativeTypeName("const unsigned char *")] byte* n, [NativeTypeName("const unsigned char *")] byte* k); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int crypto_secretbox_xchacha20poly1305_open_detached([NativeTypeName("unsigned char *")] byte* m, [NativeTypeName("const unsigned char *")] byte* c, [NativeTypeName("const unsigned char *")] byte* mac, [NativeTypeName("unsigned long long")] ulong clen, [NativeTypeName("const unsigned char *")] byte* n, [NativeTypeName("const unsigned char *")] byte* k); + + [NativeTypeName("#define crypto_secretbox_xchacha20poly1305_KEYBYTES 32U")] + public const uint crypto_secretbox_xchacha20poly1305_KEYBYTES = 32U; + + [NativeTypeName("#define crypto_secretbox_xchacha20poly1305_NONCEBYTES 24U")] + public const uint crypto_secretbox_xchacha20poly1305_NONCEBYTES = 24U; + + [NativeTypeName("#define crypto_secretbox_xchacha20poly1305_MACBYTES 16U")] + public const uint crypto_secretbox_xchacha20poly1305_MACBYTES = 16U; + + [NativeTypeName("#define crypto_secretbox_xchacha20poly1305_MESSAGEBYTES_MAX (crypto_stream_xchacha20_MESSAGEBYTES_MAX - crypto_secretbox_xchacha20poly1305_MACBYTES)")] + public const ulong crypto_secretbox_xchacha20poly1305_MESSAGEBYTES_MAX = (((0xffffffffffffffffUL) < (0xffffffffffffffffUL) ? (0xffffffffffffffffUL) : (0xffffffffffffffffUL)) - 16U); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("size_t")] + public static extern nuint crypto_secretbox_xsalsa20poly1305_keybytes(); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("size_t")] + public static extern nuint crypto_secretbox_xsalsa20poly1305_noncebytes(); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("size_t")] + public static extern nuint crypto_secretbox_xsalsa20poly1305_macbytes(); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("size_t")] + public static extern nuint crypto_secretbox_xsalsa20poly1305_messagebytes_max(); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int crypto_secretbox_xsalsa20poly1305([NativeTypeName("unsigned char *")] byte* c, [NativeTypeName("const unsigned char *")] byte* m, [NativeTypeName("unsigned long long")] ulong mlen, [NativeTypeName("const unsigned char *")] byte* n, [NativeTypeName("const unsigned char *")] byte* k); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int crypto_secretbox_xsalsa20poly1305_open([NativeTypeName("unsigned char *")] byte* m, [NativeTypeName("const unsigned char *")] byte* c, [NativeTypeName("unsigned long long")] ulong clen, [NativeTypeName("const unsigned char *")] byte* n, [NativeTypeName("const unsigned char *")] byte* k); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern void crypto_secretbox_xsalsa20poly1305_keygen([NativeTypeName("unsigned char[32]")] byte* k); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("size_t")] + public static extern nuint crypto_secretbox_xsalsa20poly1305_boxzerobytes(); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("size_t")] + public static extern nuint crypto_secretbox_xsalsa20poly1305_zerobytes(); + + [NativeTypeName("#define crypto_secretbox_xsalsa20poly1305_KEYBYTES 32U")] + public const uint crypto_secretbox_xsalsa20poly1305_KEYBYTES = 32U; + + [NativeTypeName("#define crypto_secretbox_xsalsa20poly1305_NONCEBYTES 24U")] + public const uint crypto_secretbox_xsalsa20poly1305_NONCEBYTES = 24U; + + [NativeTypeName("#define crypto_secretbox_xsalsa20poly1305_MACBYTES 16U")] + public const uint crypto_secretbox_xsalsa20poly1305_MACBYTES = 16U; + + [NativeTypeName("#define crypto_secretbox_xsalsa20poly1305_MESSAGEBYTES_MAX (crypto_stream_xsalsa20_MESSAGEBYTES_MAX - crypto_secretbox_xsalsa20poly1305_MACBYTES)")] + public const ulong crypto_secretbox_xsalsa20poly1305_MESSAGEBYTES_MAX = (((0xffffffffffffffffUL) < (0xffffffffffffffffUL) ? (0xffffffffffffffffUL) : (0xffffffffffffffffUL)) - 16U); + + [NativeTypeName("#define crypto_secretbox_xsalsa20poly1305_BOXZEROBYTES 16U")] + public const uint crypto_secretbox_xsalsa20poly1305_BOXZEROBYTES = 16U; + + [NativeTypeName("#define crypto_secretbox_xsalsa20poly1305_ZEROBYTES (crypto_secretbox_xsalsa20poly1305_BOXZEROBYTES + \\\n crypto_secretbox_xsalsa20poly1305_MACBYTES)")] + public const uint crypto_secretbox_xsalsa20poly1305_ZEROBYTES = (16U + 16U); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("size_t")] + public static extern nuint crypto_secretstream_xchacha20poly1305_abytes(); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("size_t")] + public static extern nuint crypto_secretstream_xchacha20poly1305_headerbytes(); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("size_t")] + public static extern nuint crypto_secretstream_xchacha20poly1305_keybytes(); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("size_t")] + public static extern nuint crypto_secretstream_xchacha20poly1305_messagebytes_max(); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("unsigned char")] + public static extern byte crypto_secretstream_xchacha20poly1305_tag_message(); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("unsigned char")] + public static extern byte crypto_secretstream_xchacha20poly1305_tag_push(); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("unsigned char")] + public static extern byte crypto_secretstream_xchacha20poly1305_tag_rekey(); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("unsigned char")] + public static extern byte crypto_secretstream_xchacha20poly1305_tag_final(); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("size_t")] + public static extern nuint crypto_secretstream_xchacha20poly1305_statebytes(); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern void crypto_secretstream_xchacha20poly1305_keygen([NativeTypeName("unsigned char[32]")] byte* k); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int crypto_secretstream_xchacha20poly1305_init_push(crypto_secretstream_xchacha20poly1305_state* state, [NativeTypeName("unsigned char[24]")] byte* header, [NativeTypeName("const unsigned char[32]")] byte* k); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int crypto_secretstream_xchacha20poly1305_push(crypto_secretstream_xchacha20poly1305_state* state, [NativeTypeName("unsigned char *")] byte* c, [NativeTypeName("unsigned long long *")] ulong* clen_p, [NativeTypeName("const unsigned char *")] byte* m, [NativeTypeName("unsigned long long")] ulong mlen, [NativeTypeName("const unsigned char *")] byte* ad, [NativeTypeName("unsigned long long")] ulong adlen, [NativeTypeName("unsigned char")] byte tag); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int crypto_secretstream_xchacha20poly1305_init_pull(crypto_secretstream_xchacha20poly1305_state* state, [NativeTypeName("const unsigned char[24]")] byte* header, [NativeTypeName("const unsigned char[32]")] byte* k); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int crypto_secretstream_xchacha20poly1305_pull(crypto_secretstream_xchacha20poly1305_state* state, [NativeTypeName("unsigned char *")] byte* m, [NativeTypeName("unsigned long long *")] ulong* mlen_p, [NativeTypeName("unsigned char *")] byte* tag_p, [NativeTypeName("const unsigned char *")] byte* c, [NativeTypeName("unsigned long long")] ulong clen, [NativeTypeName("const unsigned char *")] byte* ad, [NativeTypeName("unsigned long long")] ulong adlen); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern void crypto_secretstream_xchacha20poly1305_rekey(crypto_secretstream_xchacha20poly1305_state* state); + + [NativeTypeName("#define crypto_secretstream_xchacha20poly1305_ABYTES (1U + crypto_aead_xchacha20poly1305_ietf_ABYTES)")] + public const uint crypto_secretstream_xchacha20poly1305_ABYTES = (1U + 16U); + + [NativeTypeName("#define crypto_secretstream_xchacha20poly1305_HEADERBYTES crypto_aead_xchacha20poly1305_ietf_NPUBBYTES")] + public const uint crypto_secretstream_xchacha20poly1305_HEADERBYTES = 24U; + + [NativeTypeName("#define crypto_secretstream_xchacha20poly1305_KEYBYTES crypto_aead_xchacha20poly1305_ietf_KEYBYTES")] + public const uint crypto_secretstream_xchacha20poly1305_KEYBYTES = 32U; + + [NativeTypeName("#define crypto_secretstream_xchacha20poly1305_MESSAGEBYTES_MAX SODIUM_MIN(SODIUM_SIZE_MAX - crypto_secretstream_xchacha20poly1305_ABYTES, \\\n (64ULL * ((1ULL << 32) - 2ULL)))")] + public const ulong crypto_secretstream_xchacha20poly1305_MESSAGEBYTES_MAX = unchecked((((0xffffffffffffffffUL) < (0xffffffffffffffffUL) ? (0xffffffffffffffffUL) : (0xffffffffffffffffUL)) - (1U + 16U)) < ((64UL * ((1UL << 32) - 2UL))) ? (((0xffffffffffffffffUL) < (0xffffffffffffffffUL) ? (0xffffffffffffffffUL) : (0xffffffffffffffffUL)) - (1U + 16U)) : ((64UL * ((1UL << 32) - 2UL)))); + + [NativeTypeName("#define crypto_secretstream_xchacha20poly1305_TAG_MESSAGE 0x00")] + public const int crypto_secretstream_xchacha20poly1305_TAG_MESSAGE = 0x00; + + [NativeTypeName("#define crypto_secretstream_xchacha20poly1305_TAG_PUSH 0x01")] + public const int crypto_secretstream_xchacha20poly1305_TAG_PUSH = 0x01; + + [NativeTypeName("#define crypto_secretstream_xchacha20poly1305_TAG_REKEY 0x02")] + public const int crypto_secretstream_xchacha20poly1305_TAG_REKEY = 0x02; + + [NativeTypeName("#define crypto_secretstream_xchacha20poly1305_TAG_FINAL (crypto_secretstream_xchacha20poly1305_TAG_PUSH | \\\n crypto_secretstream_xchacha20poly1305_TAG_REKEY)")] + public const int crypto_secretstream_xchacha20poly1305_TAG_FINAL = (0x01 | 0x02); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("size_t")] + public static extern nuint crypto_shorthash_bytes(); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("size_t")] + public static extern nuint crypto_shorthash_keybytes(); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("const char *")] + public static extern sbyte* crypto_shorthash_primitive(); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int crypto_shorthash([NativeTypeName("unsigned char *")] byte* @out, [NativeTypeName("const unsigned char *")] byte* @in, [NativeTypeName("unsigned long long")] ulong inlen, [NativeTypeName("const unsigned char *")] byte* k); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern void crypto_shorthash_keygen([NativeTypeName("unsigned char[16]")] byte* k); + + [NativeTypeName("#define crypto_shorthash_BYTES crypto_shorthash_siphash24_BYTES")] + public const uint crypto_shorthash_BYTES = 8U; + + [NativeTypeName("#define crypto_shorthash_KEYBYTES crypto_shorthash_siphash24_KEYBYTES")] + public const uint crypto_shorthash_KEYBYTES = 16U; + + [NativeTypeName("#define crypto_shorthash_PRIMITIVE \"siphash24\"")] + public static ReadOnlySpan crypto_shorthash_PRIMITIVE => "siphash24"u8; + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("size_t")] + public static extern nuint crypto_shorthash_siphash24_bytes(); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("size_t")] + public static extern nuint crypto_shorthash_siphash24_keybytes(); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int crypto_shorthash_siphash24([NativeTypeName("unsigned char *")] byte* @out, [NativeTypeName("const unsigned char *")] byte* @in, [NativeTypeName("unsigned long long")] ulong inlen, [NativeTypeName("const unsigned char *")] byte* k); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("size_t")] + public static extern nuint crypto_shorthash_siphashx24_bytes(); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("size_t")] + public static extern nuint crypto_shorthash_siphashx24_keybytes(); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int crypto_shorthash_siphashx24([NativeTypeName("unsigned char *")] byte* @out, [NativeTypeName("const unsigned char *")] byte* @in, [NativeTypeName("unsigned long long")] ulong inlen, [NativeTypeName("const unsigned char *")] byte* k); + + [NativeTypeName("#define crypto_shorthash_siphash24_BYTES 8U")] + public const uint crypto_shorthash_siphash24_BYTES = 8U; + + [NativeTypeName("#define crypto_shorthash_siphash24_KEYBYTES 16U")] + public const uint crypto_shorthash_siphash24_KEYBYTES = 16U; + + [NativeTypeName("#define crypto_shorthash_siphashx24_BYTES 16U")] + public const uint crypto_shorthash_siphashx24_BYTES = 16U; + + [NativeTypeName("#define crypto_shorthash_siphashx24_KEYBYTES 16U")] + public const uint crypto_shorthash_siphashx24_KEYBYTES = 16U; + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("size_t")] + public static extern nuint crypto_sign_statebytes(); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("size_t")] + public static extern nuint crypto_sign_bytes(); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("size_t")] + public static extern nuint crypto_sign_seedbytes(); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("size_t")] + public static extern nuint crypto_sign_publickeybytes(); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("size_t")] + public static extern nuint crypto_sign_secretkeybytes(); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("size_t")] + public static extern nuint crypto_sign_messagebytes_max(); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("const char *")] + public static extern sbyte* crypto_sign_primitive(); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int crypto_sign_seed_keypair([NativeTypeName("unsigned char *")] byte* pk, [NativeTypeName("unsigned char *")] byte* sk, [NativeTypeName("const unsigned char *")] byte* seed); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int crypto_sign_keypair([NativeTypeName("unsigned char *")] byte* pk, [NativeTypeName("unsigned char *")] byte* sk); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int crypto_sign([NativeTypeName("unsigned char *")] byte* sm, [NativeTypeName("unsigned long long *")] ulong* smlen_p, [NativeTypeName("const unsigned char *")] byte* m, [NativeTypeName("unsigned long long")] ulong mlen, [NativeTypeName("const unsigned char *")] byte* sk); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int crypto_sign_open([NativeTypeName("unsigned char *")] byte* m, [NativeTypeName("unsigned long long *")] ulong* mlen_p, [NativeTypeName("const unsigned char *")] byte* sm, [NativeTypeName("unsigned long long")] ulong smlen, [NativeTypeName("const unsigned char *")] byte* pk); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int crypto_sign_detached([NativeTypeName("unsigned char *")] byte* sig, [NativeTypeName("unsigned long long *")] ulong* siglen_p, [NativeTypeName("const unsigned char *")] byte* m, [NativeTypeName("unsigned long long")] ulong mlen, [NativeTypeName("const unsigned char *")] byte* sk); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int crypto_sign_verify_detached([NativeTypeName("const unsigned char *")] byte* sig, [NativeTypeName("const unsigned char *")] byte* m, [NativeTypeName("unsigned long long")] ulong mlen, [NativeTypeName("const unsigned char *")] byte* pk); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int crypto_sign_init([NativeTypeName("crypto_sign_state *")] crypto_sign_ed25519ph_state* state); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int crypto_sign_update([NativeTypeName("crypto_sign_state *")] crypto_sign_ed25519ph_state* state, [NativeTypeName("const unsigned char *")] byte* m, [NativeTypeName("unsigned long long")] ulong mlen); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int crypto_sign_final_create([NativeTypeName("crypto_sign_state *")] crypto_sign_ed25519ph_state* state, [NativeTypeName("unsigned char *")] byte* sig, [NativeTypeName("unsigned long long *")] ulong* siglen_p, [NativeTypeName("const unsigned char *")] byte* sk); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int crypto_sign_final_verify([NativeTypeName("crypto_sign_state *")] crypto_sign_ed25519ph_state* state, [NativeTypeName("const unsigned char *")] byte* sig, [NativeTypeName("const unsigned char *")] byte* pk); + + [NativeTypeName("#define crypto_sign_BYTES crypto_sign_ed25519_BYTES")] + public const uint crypto_sign_BYTES = 64U; + + [NativeTypeName("#define crypto_sign_SEEDBYTES crypto_sign_ed25519_SEEDBYTES")] + public const uint crypto_sign_SEEDBYTES = 32U; + + [NativeTypeName("#define crypto_sign_PUBLICKEYBYTES crypto_sign_ed25519_PUBLICKEYBYTES")] + public const uint crypto_sign_PUBLICKEYBYTES = 32U; + + [NativeTypeName("#define crypto_sign_SECRETKEYBYTES crypto_sign_ed25519_SECRETKEYBYTES")] + public const uint crypto_sign_SECRETKEYBYTES = (32U + 32U); + + [NativeTypeName("#define crypto_sign_MESSAGEBYTES_MAX crypto_sign_ed25519_MESSAGEBYTES_MAX")] + public const ulong crypto_sign_MESSAGEBYTES_MAX = (((0xffffffffffffffffUL) < (0xffffffffffffffffUL) ? (0xffffffffffffffffUL) : (0xffffffffffffffffUL)) - 64U); + + [NativeTypeName("#define crypto_sign_PRIMITIVE \"ed25519\"")] + public static ReadOnlySpan crypto_sign_PRIMITIVE => "ed25519"u8; + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("size_t")] + public static extern nuint crypto_sign_ed25519ph_statebytes(); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("size_t")] + public static extern nuint crypto_sign_ed25519_bytes(); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("size_t")] + public static extern nuint crypto_sign_ed25519_seedbytes(); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("size_t")] + public static extern nuint crypto_sign_ed25519_publickeybytes(); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("size_t")] + public static extern nuint crypto_sign_ed25519_secretkeybytes(); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("size_t")] + public static extern nuint crypto_sign_ed25519_messagebytes_max(); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int crypto_sign_ed25519([NativeTypeName("unsigned char *")] byte* sm, [NativeTypeName("unsigned long long *")] ulong* smlen_p, [NativeTypeName("const unsigned char *")] byte* m, [NativeTypeName("unsigned long long")] ulong mlen, [NativeTypeName("const unsigned char *")] byte* sk); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int crypto_sign_ed25519_open([NativeTypeName("unsigned char *")] byte* m, [NativeTypeName("unsigned long long *")] ulong* mlen_p, [NativeTypeName("const unsigned char *")] byte* sm, [NativeTypeName("unsigned long long")] ulong smlen, [NativeTypeName("const unsigned char *")] byte* pk); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int crypto_sign_ed25519_detached([NativeTypeName("unsigned char *")] byte* sig, [NativeTypeName("unsigned long long *")] ulong* siglen_p, [NativeTypeName("const unsigned char *")] byte* m, [NativeTypeName("unsigned long long")] ulong mlen, [NativeTypeName("const unsigned char *")] byte* sk); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int crypto_sign_ed25519_verify_detached([NativeTypeName("const unsigned char *")] byte* sig, [NativeTypeName("const unsigned char *")] byte* m, [NativeTypeName("unsigned long long")] ulong mlen, [NativeTypeName("const unsigned char *")] byte* pk); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int crypto_sign_ed25519_keypair([NativeTypeName("unsigned char *")] byte* pk, [NativeTypeName("unsigned char *")] byte* sk); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int crypto_sign_ed25519_seed_keypair([NativeTypeName("unsigned char *")] byte* pk, [NativeTypeName("unsigned char *")] byte* sk, [NativeTypeName("const unsigned char *")] byte* seed); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int crypto_sign_ed25519_pk_to_curve25519([NativeTypeName("unsigned char *")] byte* curve25519_pk, [NativeTypeName("const unsigned char *")] byte* ed25519_pk); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int crypto_sign_ed25519_sk_to_curve25519([NativeTypeName("unsigned char *")] byte* curve25519_sk, [NativeTypeName("const unsigned char *")] byte* ed25519_sk); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int crypto_sign_ed25519_sk_to_seed([NativeTypeName("unsigned char *")] byte* seed, [NativeTypeName("const unsigned char *")] byte* sk); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int crypto_sign_ed25519_sk_to_pk([NativeTypeName("unsigned char *")] byte* pk, [NativeTypeName("const unsigned char *")] byte* sk); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int crypto_sign_ed25519ph_init(crypto_sign_ed25519ph_state* state); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int crypto_sign_ed25519ph_update(crypto_sign_ed25519ph_state* state, [NativeTypeName("const unsigned char *")] byte* m, [NativeTypeName("unsigned long long")] ulong mlen); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int crypto_sign_ed25519ph_final_create(crypto_sign_ed25519ph_state* state, [NativeTypeName("unsigned char *")] byte* sig, [NativeTypeName("unsigned long long *")] ulong* siglen_p, [NativeTypeName("const unsigned char *")] byte* sk); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int crypto_sign_ed25519ph_final_verify(crypto_sign_ed25519ph_state* state, [NativeTypeName("const unsigned char *")] byte* sig, [NativeTypeName("const unsigned char *")] byte* pk); + + [NativeTypeName("#define crypto_sign_ed25519_BYTES 64U")] + public const uint crypto_sign_ed25519_BYTES = 64U; + + [NativeTypeName("#define crypto_sign_ed25519_SEEDBYTES 32U")] + public const uint crypto_sign_ed25519_SEEDBYTES = 32U; + + [NativeTypeName("#define crypto_sign_ed25519_PUBLICKEYBYTES 32U")] + public const uint crypto_sign_ed25519_PUBLICKEYBYTES = 32U; + + [NativeTypeName("#define crypto_sign_ed25519_SECRETKEYBYTES (32U + 32U)")] + public const uint crypto_sign_ed25519_SECRETKEYBYTES = (32U + 32U); + + [NativeTypeName("#define crypto_sign_ed25519_MESSAGEBYTES_MAX (SODIUM_SIZE_MAX - crypto_sign_ed25519_BYTES)")] + public const ulong crypto_sign_ed25519_MESSAGEBYTES_MAX = (((0xffffffffffffffffUL) < (0xffffffffffffffffUL) ? (0xffffffffffffffffUL) : (0xffffffffffffffffUL)) - 64U); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [Obsolete] + public static extern int crypto_sign_edwards25519sha512batch([NativeTypeName("unsigned char *")] byte* sm, [NativeTypeName("unsigned long long *")] ulong* smlen_p, [NativeTypeName("const unsigned char *")] byte* m, [NativeTypeName("unsigned long long")] ulong mlen, [NativeTypeName("const unsigned char *")] byte* sk); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [Obsolete] + public static extern int crypto_sign_edwards25519sha512batch_open([NativeTypeName("unsigned char *")] byte* m, [NativeTypeName("unsigned long long *")] ulong* mlen_p, [NativeTypeName("const unsigned char *")] byte* sm, [NativeTypeName("unsigned long long")] ulong smlen, [NativeTypeName("const unsigned char *")] byte* pk); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [Obsolete] + public static extern int crypto_sign_edwards25519sha512batch_keypair([NativeTypeName("unsigned char *")] byte* pk, [NativeTypeName("unsigned char *")] byte* sk); + + [NativeTypeName("#define crypto_sign_edwards25519sha512batch_BYTES 64U")] + public const uint crypto_sign_edwards25519sha512batch_BYTES = 64U; + + [NativeTypeName("#define crypto_sign_edwards25519sha512batch_PUBLICKEYBYTES 32U")] + public const uint crypto_sign_edwards25519sha512batch_PUBLICKEYBYTES = 32U; + + [NativeTypeName("#define crypto_sign_edwards25519sha512batch_SECRETKEYBYTES (32U + 32U)")] + public const uint crypto_sign_edwards25519sha512batch_SECRETKEYBYTES = (32U + 32U); + + [NativeTypeName("#define crypto_sign_edwards25519sha512batch_MESSAGEBYTES_MAX (SODIUM_SIZE_MAX - crypto_sign_edwards25519sha512batch_BYTES)")] + public const ulong crypto_sign_edwards25519sha512batch_MESSAGEBYTES_MAX = (((0xffffffffffffffffUL) < (0xffffffffffffffffUL) ? (0xffffffffffffffffUL) : (0xffffffffffffffffUL)) - 64U); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("size_t")] + public static extern nuint crypto_stream_keybytes(); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("size_t")] + public static extern nuint crypto_stream_noncebytes(); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("size_t")] + public static extern nuint crypto_stream_messagebytes_max(); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("const char *")] + public static extern sbyte* crypto_stream_primitive(); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int crypto_stream([NativeTypeName("unsigned char *")] byte* c, [NativeTypeName("unsigned long long")] ulong clen, [NativeTypeName("const unsigned char *")] byte* n, [NativeTypeName("const unsigned char *")] byte* k); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int crypto_stream_xor([NativeTypeName("unsigned char *")] byte* c, [NativeTypeName("const unsigned char *")] byte* m, [NativeTypeName("unsigned long long")] ulong mlen, [NativeTypeName("const unsigned char *")] byte* n, [NativeTypeName("const unsigned char *")] byte* k); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern void crypto_stream_keygen([NativeTypeName("unsigned char[32]")] byte* k); + + [NativeTypeName("#define crypto_stream_KEYBYTES crypto_stream_xsalsa20_KEYBYTES")] + public const uint crypto_stream_KEYBYTES = 32U; + + [NativeTypeName("#define crypto_stream_NONCEBYTES crypto_stream_xsalsa20_NONCEBYTES")] + public const uint crypto_stream_NONCEBYTES = 24U; + + [NativeTypeName("#define crypto_stream_MESSAGEBYTES_MAX crypto_stream_xsalsa20_MESSAGEBYTES_MAX")] + public const ulong crypto_stream_MESSAGEBYTES_MAX = ((0xffffffffffffffffUL) < (0xffffffffffffffffUL) ? (0xffffffffffffffffUL) : (0xffffffffffffffffUL)); + + [NativeTypeName("#define crypto_stream_PRIMITIVE \"xsalsa20\"")] + public static ReadOnlySpan crypto_stream_PRIMITIVE => "xsalsa20"u8; + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("size_t")] + public static extern nuint crypto_stream_chacha20_keybytes(); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("size_t")] + public static extern nuint crypto_stream_chacha20_noncebytes(); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("size_t")] + public static extern nuint crypto_stream_chacha20_messagebytes_max(); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int crypto_stream_chacha20([NativeTypeName("unsigned char *")] byte* c, [NativeTypeName("unsigned long long")] ulong clen, [NativeTypeName("const unsigned char *")] byte* n, [NativeTypeName("const unsigned char *")] byte* k); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int crypto_stream_chacha20_xor([NativeTypeName("unsigned char *")] byte* c, [NativeTypeName("const unsigned char *")] byte* m, [NativeTypeName("unsigned long long")] ulong mlen, [NativeTypeName("const unsigned char *")] byte* n, [NativeTypeName("const unsigned char *")] byte* k); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int crypto_stream_chacha20_xor_ic([NativeTypeName("unsigned char *")] byte* c, [NativeTypeName("const unsigned char *")] byte* m, [NativeTypeName("unsigned long long")] ulong mlen, [NativeTypeName("const unsigned char *")] byte* n, [NativeTypeName("uint64_t")] ulong ic, [NativeTypeName("const unsigned char *")] byte* k); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern void crypto_stream_chacha20_keygen([NativeTypeName("unsigned char[32]")] byte* k); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("size_t")] + public static extern nuint crypto_stream_chacha20_ietf_keybytes(); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("size_t")] + public static extern nuint crypto_stream_chacha20_ietf_noncebytes(); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("size_t")] + public static extern nuint crypto_stream_chacha20_ietf_messagebytes_max(); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int crypto_stream_chacha20_ietf([NativeTypeName("unsigned char *")] byte* c, [NativeTypeName("unsigned long long")] ulong clen, [NativeTypeName("const unsigned char *")] byte* n, [NativeTypeName("const unsigned char *")] byte* k); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int crypto_stream_chacha20_ietf_xor([NativeTypeName("unsigned char *")] byte* c, [NativeTypeName("const unsigned char *")] byte* m, [NativeTypeName("unsigned long long")] ulong mlen, [NativeTypeName("const unsigned char *")] byte* n, [NativeTypeName("const unsigned char *")] byte* k); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int crypto_stream_chacha20_ietf_xor_ic([NativeTypeName("unsigned char *")] byte* c, [NativeTypeName("const unsigned char *")] byte* m, [NativeTypeName("unsigned long long")] ulong mlen, [NativeTypeName("const unsigned char *")] byte* n, [NativeTypeName("uint32_t")] uint ic, [NativeTypeName("const unsigned char *")] byte* k); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern void crypto_stream_chacha20_ietf_keygen([NativeTypeName("unsigned char[32]")] byte* k); + + [NativeTypeName("#define crypto_stream_chacha20_KEYBYTES 32U")] + public const uint crypto_stream_chacha20_KEYBYTES = 32U; + + [NativeTypeName("#define crypto_stream_chacha20_NONCEBYTES 8U")] + public const uint crypto_stream_chacha20_NONCEBYTES = 8U; + + [NativeTypeName("#define crypto_stream_chacha20_MESSAGEBYTES_MAX SODIUM_SIZE_MAX")] + public const ulong crypto_stream_chacha20_MESSAGEBYTES_MAX = ((0xffffffffffffffffUL) < (0xffffffffffffffffUL) ? (0xffffffffffffffffUL) : (0xffffffffffffffffUL)); + + [NativeTypeName("#define crypto_stream_chacha20_ietf_KEYBYTES 32U")] + public const uint crypto_stream_chacha20_ietf_KEYBYTES = 32U; + + [NativeTypeName("#define crypto_stream_chacha20_ietf_NONCEBYTES 12U")] + public const uint crypto_stream_chacha20_ietf_NONCEBYTES = 12U; + + [NativeTypeName("#define crypto_stream_chacha20_ietf_MESSAGEBYTES_MAX SODIUM_MIN(SODIUM_SIZE_MAX, 64ULL * (1ULL << 32))")] + public const ulong crypto_stream_chacha20_ietf_MESSAGEBYTES_MAX = ((((0xffffffffffffffffUL) < (0xffffffffffffffffUL) ? (0xffffffffffffffffUL) : (0xffffffffffffffffUL))) < (64UL * (1UL << 32)) ? (((0xffffffffffffffffUL) < (0xffffffffffffffffUL) ? (0xffffffffffffffffUL) : (0xffffffffffffffffUL))) : (64UL * (1UL << 32))); + + [NativeTypeName("#define crypto_stream_chacha20_IETF_KEYBYTES crypto_stream_chacha20_ietf_KEYBYTES")] + public const uint crypto_stream_chacha20_IETF_KEYBYTES = 32U; + + [NativeTypeName("#define crypto_stream_chacha20_IETF_NONCEBYTES crypto_stream_chacha20_ietf_NONCEBYTES")] + public const uint crypto_stream_chacha20_IETF_NONCEBYTES = 12U; + + [NativeTypeName("#define crypto_stream_chacha20_IETF_MESSAGEBYTES_MAX crypto_stream_chacha20_ietf_MESSAGEBYTES_MAX")] + public const ulong crypto_stream_chacha20_IETF_MESSAGEBYTES_MAX = ((((0xffffffffffffffffUL) < (0xffffffffffffffffUL) ? (0xffffffffffffffffUL) : (0xffffffffffffffffUL))) < (64UL * (1UL << 32)) ? (((0xffffffffffffffffUL) < (0xffffffffffffffffUL) ? (0xffffffffffffffffUL) : (0xffffffffffffffffUL))) : (64UL * (1UL << 32))); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("size_t")] + public static extern nuint crypto_stream_salsa20_keybytes(); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("size_t")] + public static extern nuint crypto_stream_salsa20_noncebytes(); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("size_t")] + public static extern nuint crypto_stream_salsa20_messagebytes_max(); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int crypto_stream_salsa20([NativeTypeName("unsigned char *")] byte* c, [NativeTypeName("unsigned long long")] ulong clen, [NativeTypeName("const unsigned char *")] byte* n, [NativeTypeName("const unsigned char *")] byte* k); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int crypto_stream_salsa20_xor([NativeTypeName("unsigned char *")] byte* c, [NativeTypeName("const unsigned char *")] byte* m, [NativeTypeName("unsigned long long")] ulong mlen, [NativeTypeName("const unsigned char *")] byte* n, [NativeTypeName("const unsigned char *")] byte* k); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int crypto_stream_salsa20_xor_ic([NativeTypeName("unsigned char *")] byte* c, [NativeTypeName("const unsigned char *")] byte* m, [NativeTypeName("unsigned long long")] ulong mlen, [NativeTypeName("const unsigned char *")] byte* n, [NativeTypeName("uint64_t")] ulong ic, [NativeTypeName("const unsigned char *")] byte* k); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern void crypto_stream_salsa20_keygen([NativeTypeName("unsigned char[32]")] byte* k); + + [NativeTypeName("#define crypto_stream_salsa20_KEYBYTES 32U")] + public const uint crypto_stream_salsa20_KEYBYTES = 32U; + + [NativeTypeName("#define crypto_stream_salsa20_NONCEBYTES 8U")] + public const uint crypto_stream_salsa20_NONCEBYTES = 8U; + + [NativeTypeName("#define crypto_stream_salsa20_MESSAGEBYTES_MAX SODIUM_SIZE_MAX")] + public const ulong crypto_stream_salsa20_MESSAGEBYTES_MAX = ((0xffffffffffffffffUL) < (0xffffffffffffffffUL) ? (0xffffffffffffffffUL) : (0xffffffffffffffffUL)); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("size_t")] + [Obsolete] + public static extern nuint crypto_stream_salsa208_keybytes(); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("size_t")] + [Obsolete] + public static extern nuint crypto_stream_salsa208_noncebytes(); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("size_t")] + [Obsolete] + public static extern nuint crypto_stream_salsa208_messagebytes_max(); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [Obsolete] + public static extern int crypto_stream_salsa208([NativeTypeName("unsigned char *")] byte* c, [NativeTypeName("unsigned long long")] ulong clen, [NativeTypeName("const unsigned char *")] byte* n, [NativeTypeName("const unsigned char *")] byte* k); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [Obsolete] + public static extern int crypto_stream_salsa208_xor([NativeTypeName("unsigned char *")] byte* c, [NativeTypeName("const unsigned char *")] byte* m, [NativeTypeName("unsigned long long")] ulong mlen, [NativeTypeName("const unsigned char *")] byte* n, [NativeTypeName("const unsigned char *")] byte* k); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [Obsolete] + public static extern void crypto_stream_salsa208_keygen([NativeTypeName("unsigned char[32]")] byte* k); + + [NativeTypeName("#define crypto_stream_salsa208_KEYBYTES 32U")] + public const uint crypto_stream_salsa208_KEYBYTES = 32U; + + [NativeTypeName("#define crypto_stream_salsa208_NONCEBYTES 8U")] + public const uint crypto_stream_salsa208_NONCEBYTES = 8U; + + [NativeTypeName("#define crypto_stream_salsa208_MESSAGEBYTES_MAX SODIUM_SIZE_MAX")] + public const ulong crypto_stream_salsa208_MESSAGEBYTES_MAX = ((0xffffffffffffffffUL) < (0xffffffffffffffffUL) ? (0xffffffffffffffffUL) : (0xffffffffffffffffUL)); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("size_t")] + public static extern nuint crypto_stream_salsa2012_keybytes(); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("size_t")] + public static extern nuint crypto_stream_salsa2012_noncebytes(); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("size_t")] + public static extern nuint crypto_stream_salsa2012_messagebytes_max(); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int crypto_stream_salsa2012([NativeTypeName("unsigned char *")] byte* c, [NativeTypeName("unsigned long long")] ulong clen, [NativeTypeName("const unsigned char *")] byte* n, [NativeTypeName("const unsigned char *")] byte* k); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int crypto_stream_salsa2012_xor([NativeTypeName("unsigned char *")] byte* c, [NativeTypeName("const unsigned char *")] byte* m, [NativeTypeName("unsigned long long")] ulong mlen, [NativeTypeName("const unsigned char *")] byte* n, [NativeTypeName("const unsigned char *")] byte* k); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern void crypto_stream_salsa2012_keygen([NativeTypeName("unsigned char[32]")] byte* k); + + [NativeTypeName("#define crypto_stream_salsa2012_KEYBYTES 32U")] + public const uint crypto_stream_salsa2012_KEYBYTES = 32U; + + [NativeTypeName("#define crypto_stream_salsa2012_NONCEBYTES 8U")] + public const uint crypto_stream_salsa2012_NONCEBYTES = 8U; + + [NativeTypeName("#define crypto_stream_salsa2012_MESSAGEBYTES_MAX SODIUM_SIZE_MAX")] + public const ulong crypto_stream_salsa2012_MESSAGEBYTES_MAX = ((0xffffffffffffffffUL) < (0xffffffffffffffffUL) ? (0xffffffffffffffffUL) : (0xffffffffffffffffUL)); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("size_t")] + public static extern nuint crypto_stream_xchacha20_keybytes(); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("size_t")] + public static extern nuint crypto_stream_xchacha20_noncebytes(); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("size_t")] + public static extern nuint crypto_stream_xchacha20_messagebytes_max(); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int crypto_stream_xchacha20([NativeTypeName("unsigned char *")] byte* c, [NativeTypeName("unsigned long long")] ulong clen, [NativeTypeName("const unsigned char *")] byte* n, [NativeTypeName("const unsigned char *")] byte* k); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int crypto_stream_xchacha20_xor([NativeTypeName("unsigned char *")] byte* c, [NativeTypeName("const unsigned char *")] byte* m, [NativeTypeName("unsigned long long")] ulong mlen, [NativeTypeName("const unsigned char *")] byte* n, [NativeTypeName("const unsigned char *")] byte* k); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int crypto_stream_xchacha20_xor_ic([NativeTypeName("unsigned char *")] byte* c, [NativeTypeName("const unsigned char *")] byte* m, [NativeTypeName("unsigned long long")] ulong mlen, [NativeTypeName("const unsigned char *")] byte* n, [NativeTypeName("uint64_t")] ulong ic, [NativeTypeName("const unsigned char *")] byte* k); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern void crypto_stream_xchacha20_keygen([NativeTypeName("unsigned char[32]")] byte* k); + + [NativeTypeName("#define crypto_stream_xchacha20_KEYBYTES 32U")] + public const uint crypto_stream_xchacha20_KEYBYTES = 32U; + + [NativeTypeName("#define crypto_stream_xchacha20_NONCEBYTES 24U")] + public const uint crypto_stream_xchacha20_NONCEBYTES = 24U; + + [NativeTypeName("#define crypto_stream_xchacha20_MESSAGEBYTES_MAX SODIUM_SIZE_MAX")] + public const ulong crypto_stream_xchacha20_MESSAGEBYTES_MAX = ((0xffffffffffffffffUL) < (0xffffffffffffffffUL) ? (0xffffffffffffffffUL) : (0xffffffffffffffffUL)); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("size_t")] + public static extern nuint crypto_stream_xsalsa20_keybytes(); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("size_t")] + public static extern nuint crypto_stream_xsalsa20_noncebytes(); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("size_t")] + public static extern nuint crypto_stream_xsalsa20_messagebytes_max(); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int crypto_stream_xsalsa20([NativeTypeName("unsigned char *")] byte* c, [NativeTypeName("unsigned long long")] ulong clen, [NativeTypeName("const unsigned char *")] byte* n, [NativeTypeName("const unsigned char *")] byte* k); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int crypto_stream_xsalsa20_xor([NativeTypeName("unsigned char *")] byte* c, [NativeTypeName("const unsigned char *")] byte* m, [NativeTypeName("unsigned long long")] ulong mlen, [NativeTypeName("const unsigned char *")] byte* n, [NativeTypeName("const unsigned char *")] byte* k); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int crypto_stream_xsalsa20_xor_ic([NativeTypeName("unsigned char *")] byte* c, [NativeTypeName("const unsigned char *")] byte* m, [NativeTypeName("unsigned long long")] ulong mlen, [NativeTypeName("const unsigned char *")] byte* n, [NativeTypeName("uint64_t")] ulong ic, [NativeTypeName("const unsigned char *")] byte* k); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern void crypto_stream_xsalsa20_keygen([NativeTypeName("unsigned char[32]")] byte* k); + + [NativeTypeName("#define crypto_stream_xsalsa20_KEYBYTES 32U")] + public const uint crypto_stream_xsalsa20_KEYBYTES = 32U; + + [NativeTypeName("#define crypto_stream_xsalsa20_NONCEBYTES 24U")] + public const uint crypto_stream_xsalsa20_NONCEBYTES = 24U; + + [NativeTypeName("#define crypto_stream_xsalsa20_MESSAGEBYTES_MAX SODIUM_SIZE_MAX")] + public const ulong crypto_stream_xsalsa20_MESSAGEBYTES_MAX = ((0xffffffffffffffffUL) < (0xffffffffffffffffUL) ? (0xffffffffffffffffUL) : (0xffffffffffffffffUL)); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("size_t")] + public static extern nuint crypto_verify_16_bytes(); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int crypto_verify_16([NativeTypeName("const unsigned char *")] byte* x, [NativeTypeName("const unsigned char *")] byte* y); + + [NativeTypeName("#define crypto_verify_16_BYTES 16U")] + public const uint crypto_verify_16_BYTES = 16U; + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("size_t")] + public static extern nuint crypto_verify_32_bytes(); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int crypto_verify_32([NativeTypeName("const unsigned char *")] byte* x, [NativeTypeName("const unsigned char *")] byte* y); + + [NativeTypeName("#define crypto_verify_32_BYTES 32U")] + public const uint crypto_verify_32_BYTES = 32U; + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("size_t")] + public static extern nuint crypto_verify_64_bytes(); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int crypto_verify_64([NativeTypeName("const unsigned char *")] byte* x, [NativeTypeName("const unsigned char *")] byte* y); + + [NativeTypeName("#define crypto_verify_64_BYTES 64U")] + public const uint crypto_verify_64_BYTES = 64U; + + [NativeTypeName("#define SODIUM_SIZE_MAX SODIUM_MIN(UINT64_MAX, SIZE_MAX)")] + public const ulong SODIUM_SIZE_MAX = ((0xffffffffffffffffUL) < (0xffffffffffffffffUL) ? (0xffffffffffffffffUL) : (0xffffffffffffffffUL)); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("size_t")] + public static extern nuint randombytes_seedbytes(); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern void randombytes_buf([NativeTypeName("void *const")] void* buf, [NativeTypeName("const size_t")] nuint size); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern void randombytes_buf_deterministic([NativeTypeName("void *const")] void* buf, [NativeTypeName("const size_t")] nuint size, [NativeTypeName("const unsigned char[32]")] byte* seed); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("uint32_t")] + public static extern uint randombytes_random(); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("uint32_t")] + public static extern uint randombytes_uniform([NativeTypeName("const uint32_t")] uint upper_bound); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern void randombytes_stir(); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int randombytes_close(); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int randombytes_set_implementation([NativeTypeName("const randombytes_implementation *")] randombytes_implementation* impl); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("const char *")] + public static extern sbyte* randombytes_implementation_name(); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern void randombytes([NativeTypeName("unsigned char *const")] byte* buf, [NativeTypeName("const unsigned long long")] ulong buf_len); + + [NativeTypeName("#define randombytes_BYTES_MAX SODIUM_MIN(SODIUM_SIZE_MAX, 0xffffffffUL)")] + public const ulong randombytes_BYTES_MAX = ((((0xffffffffffffffffUL) < (0xffffffffffffffffUL) ? (0xffffffffffffffffUL) : (0xffffffffffffffffUL))) < (0xffffffffU) ? (((0xffffffffffffffffUL) < (0xffffffffffffffffUL) ? (0xffffffffffffffffUL) : (0xffffffffffffffffUL))) : (0xffffffffU)); + + [NativeTypeName("#define randombytes_SEEDBYTES 32U")] + public const uint randombytes_SEEDBYTES = 32U; + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int sodium_runtime_has_neon(); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int sodium_runtime_has_armcrypto(); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int sodium_runtime_has_sse2(); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int sodium_runtime_has_sse3(); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int sodium_runtime_has_ssse3(); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int sodium_runtime_has_sse41(); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int sodium_runtime_has_avx(); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int sodium_runtime_has_avx2(); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int sodium_runtime_has_avx512f(); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int sodium_runtime_has_pclmul(); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int sodium_runtime_has_aesni(); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int sodium_runtime_has_rdrand(); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int _sodium_runtime_get_cpu_features(); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern void sodium_memzero([NativeTypeName("void *const")] void* pnt, [NativeTypeName("const size_t")] nuint len); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern void sodium_stackzero([NativeTypeName("const size_t")] nuint len); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int sodium_memcmp([NativeTypeName("const void *const")] void* b1_, [NativeTypeName("const void *const")] void* b2_, [NativeTypeName("size_t")] nuint len); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int sodium_compare([NativeTypeName("const unsigned char *")] byte* b1_, [NativeTypeName("const unsigned char *")] byte* b2_, [NativeTypeName("size_t")] nuint len); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int sodium_is_zero([NativeTypeName("const unsigned char *")] byte* n, [NativeTypeName("const size_t")] nuint nlen); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern void sodium_increment([NativeTypeName("unsigned char *")] byte* n, [NativeTypeName("const size_t")] nuint nlen); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern void sodium_add([NativeTypeName("unsigned char *")] byte* a, [NativeTypeName("const unsigned char *")] byte* b, [NativeTypeName("const size_t")] nuint len); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern void sodium_sub([NativeTypeName("unsigned char *")] byte* a, [NativeTypeName("const unsigned char *")] byte* b, [NativeTypeName("const size_t")] nuint len); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("char *")] + public static extern sbyte* sodium_bin2hex([NativeTypeName("char *const")] sbyte* hex, [NativeTypeName("const size_t")] nuint hex_maxlen, [NativeTypeName("const unsigned char *const")] byte* bin, [NativeTypeName("const size_t")] nuint bin_len); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int sodium_hex2bin([NativeTypeName("unsigned char *const")] byte* bin, [NativeTypeName("const size_t")] nuint bin_maxlen, [NativeTypeName("const char *const")] sbyte* hex, [NativeTypeName("const size_t")] nuint hex_len, [NativeTypeName("const char *const")] sbyte* ignore, [NativeTypeName("size_t *")] nuint* bin_len, [NativeTypeName("const char **const")] sbyte** hex_end); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("size_t")] + public static extern nuint sodium_base64_encoded_len([NativeTypeName("const size_t")] nuint bin_len, [NativeTypeName("const int")] int variant); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("char *")] + public static extern sbyte* sodium_bin2base64([NativeTypeName("char *const")] sbyte* b64, [NativeTypeName("const size_t")] nuint b64_maxlen, [NativeTypeName("const unsigned char *const")] byte* bin, [NativeTypeName("const size_t")] nuint bin_len, [NativeTypeName("const int")] int variant); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int sodium_base642bin([NativeTypeName("unsigned char *const")] byte* bin, [NativeTypeName("const size_t")] nuint bin_maxlen, [NativeTypeName("const char *const")] sbyte* b64, [NativeTypeName("const size_t")] nuint b64_len, [NativeTypeName("const char *const")] sbyte* ignore, [NativeTypeName("size_t *")] nuint* bin_len, [NativeTypeName("const char **const")] sbyte** b64_end, [NativeTypeName("const int")] int variant); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int sodium_mlock([NativeTypeName("void *const")] void* addr, [NativeTypeName("const size_t")] nuint len); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int sodium_munlock([NativeTypeName("void *const")] void* addr, [NativeTypeName("const size_t")] nuint len); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern void* sodium_malloc([NativeTypeName("const size_t")] nuint size); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern void* sodium_allocarray([NativeTypeName("size_t")] nuint count, [NativeTypeName("size_t")] nuint size); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern void sodium_free(void* ptr); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int sodium_mprotect_noaccess(void* ptr); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int sodium_mprotect_readonly(void* ptr); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int sodium_mprotect_readwrite(void* ptr); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int sodium_pad([NativeTypeName("size_t *")] nuint* padded_buflen_p, [NativeTypeName("unsigned char *")] byte* buf, [NativeTypeName("size_t")] nuint unpadded_buflen, [NativeTypeName("size_t")] nuint blocksize, [NativeTypeName("size_t")] nuint max_buflen); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int sodium_unpad([NativeTypeName("size_t *")] nuint* unpadded_buflen_p, [NativeTypeName("const unsigned char *")] byte* buf, [NativeTypeName("size_t")] nuint padded_buflen, [NativeTypeName("size_t")] nuint blocksize); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int _sodium_alloc_init(); + + [NativeTypeName("#define sodium_base64_VARIANT_ORIGINAL 1")] + public const int sodium_base64_VARIANT_ORIGINAL = 1; + + [NativeTypeName("#define sodium_base64_VARIANT_ORIGINAL_NO_PADDING 3")] + public const int sodium_base64_VARIANT_ORIGINAL_NO_PADDING = 3; + + [NativeTypeName("#define sodium_base64_VARIANT_URLSAFE 5")] + public const int sodium_base64_VARIANT_URLSAFE = 5; + + [NativeTypeName("#define sodium_base64_VARIANT_URLSAFE_NO_PADDING 7")] + public const int sodium_base64_VARIANT_URLSAFE_NO_PADDING = 7; + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + [return: NativeTypeName("const char *")] + public static extern sbyte* sodium_version_string(); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int sodium_library_version_major(); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int sodium_library_version_minor(); + + [DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)] + public static extern int sodium_library_minimal(); + + [NativeTypeName("#define SODIUM_VERSION_STRING \"1.0.20\"")] + public static ReadOnlySpan SODIUM_VERSION_STRING => "1.0.20"u8; + + [NativeTypeName("#define SODIUM_LIBRARY_VERSION_MAJOR 26")] + public const int SODIUM_LIBRARY_VERSION_MAJOR = 26; + + [NativeTypeName("#define SODIUM_LIBRARY_VERSION_MINOR 2")] + public const int SODIUM_LIBRARY_VERSION_MINOR = 2; + } +} diff --git a/Scripts/CSSUDII.Sodium.Interop/Generated/NativeAnnotationAttribute.cs b/Scripts/CSSUDII.Sodium.Interop/Generated/NativeAnnotationAttribute.cs new file mode 100644 index 0000000..23b2db8 --- /dev/null +++ b/Scripts/CSSUDII.Sodium.Interop/Generated/NativeAnnotationAttribute.cs @@ -0,0 +1,23 @@ +using System; +using System.Diagnostics; + +namespace CSSUDII.Sodium.Interop +{ + /// Defines the annotation found in a native declaration. + [AttributeUsage(AttributeTargets.Struct | AttributeTargets.Enum | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter | AttributeTargets.ReturnValue, AllowMultiple = true, Inherited = false)] + [Conditional("DEBUG")] + internal sealed partial class NativeAnnotationAttribute : Attribute + { + private readonly string _annotation; + + /// Initializes a new instance of the class. + /// The annotation that was used in the native declaration. + public NativeAnnotationAttribute(string annotation) + { + _annotation = annotation; + } + + /// Gets the annotation that was used in the native declaration. + public string Annotation => _annotation; + } +} diff --git a/Scripts/CSSUDII.Sodium.Interop/Generated/NativeTypeNameAttribute.cs b/Scripts/CSSUDII.Sodium.Interop/Generated/NativeTypeNameAttribute.cs new file mode 100644 index 0000000..966cece --- /dev/null +++ b/Scripts/CSSUDII.Sodium.Interop/Generated/NativeTypeNameAttribute.cs @@ -0,0 +1,23 @@ +using System; +using System.Diagnostics; + +namespace CSSUDII.Sodium.Interop +{ + /// Defines the type of a member as it was used in the native signature. + [AttributeUsage(AttributeTargets.Struct | AttributeTargets.Enum | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter | AttributeTargets.ReturnValue, AllowMultiple = false, Inherited = true)] + [Conditional("DEBUG")] + internal sealed partial class NativeTypeNameAttribute : Attribute + { + private readonly string _name; + + /// Initializes a new instance of the class. + /// The name of the type that was used in the native signature. + public NativeTypeNameAttribute(string name) + { + _name = name; + } + + /// Gets the name of the type that was used in the native signature. + public string Name => _name; + } +} diff --git a/Scripts/CSSUDII.Sodium.Interop/Generated/crypto_aead_aes256gcm_state.cs b/Scripts/CSSUDII.Sodium.Interop/Generated/crypto_aead_aes256gcm_state.cs new file mode 100644 index 0000000..ab01057 --- /dev/null +++ b/Scripts/CSSUDII.Sodium.Interop/Generated/crypto_aead_aes256gcm_state.cs @@ -0,0 +1,16 @@ +using System.Runtime.CompilerServices; + +namespace CSSUDII.Sodium.Interop +{ + public partial struct crypto_aead_aes256gcm_state + { + [NativeTypeName("unsigned char[512]")] + public _opaque_e__FixedBuffer opaque; + + [InlineArray(512)] + public partial struct _opaque_e__FixedBuffer + { + public byte e0; + } + } +} diff --git a/Scripts/CSSUDII.Sodium.Interop/Generated/crypto_auth_hmacsha256_state.cs b/Scripts/CSSUDII.Sodium.Interop/Generated/crypto_auth_hmacsha256_state.cs new file mode 100644 index 0000000..20c93e5 --- /dev/null +++ b/Scripts/CSSUDII.Sodium.Interop/Generated/crypto_auth_hmacsha256_state.cs @@ -0,0 +1,9 @@ +namespace CSSUDII.Sodium.Interop +{ + public partial struct crypto_auth_hmacsha256_state + { + public crypto_hash_sha256_state ictx; + + public crypto_hash_sha256_state octx; + } +} diff --git a/Scripts/CSSUDII.Sodium.Interop/Generated/crypto_auth_hmacsha512256_state.cs b/Scripts/CSSUDII.Sodium.Interop/Generated/crypto_auth_hmacsha512256_state.cs new file mode 100644 index 0000000..dd99c73 --- /dev/null +++ b/Scripts/CSSUDII.Sodium.Interop/Generated/crypto_auth_hmacsha512256_state.cs @@ -0,0 +1,9 @@ +namespace CSSUDII.Sodium.Interop +{ + public partial struct crypto_auth_hmacsha512256_state + { + public crypto_hash_sha512_state ictx; + + public crypto_hash_sha512_state octx; + } +} diff --git a/Scripts/CSSUDII.Sodium.Interop/Generated/crypto_generichash_blake2b_state.cs b/Scripts/CSSUDII.Sodium.Interop/Generated/crypto_generichash_blake2b_state.cs new file mode 100644 index 0000000..3f0f38d --- /dev/null +++ b/Scripts/CSSUDII.Sodium.Interop/Generated/crypto_generichash_blake2b_state.cs @@ -0,0 +1,16 @@ +using System.Runtime.CompilerServices; + +namespace CSSUDII.Sodium.Interop +{ + public partial struct crypto_generichash_blake2b_state + { + [NativeTypeName("unsigned char[384]")] + public _opaque_e__FixedBuffer opaque; + + [InlineArray(384)] + public partial struct _opaque_e__FixedBuffer + { + public byte e0; + } + } +} diff --git a/Scripts/CSSUDII.Sodium.Interop/Generated/crypto_hash_sha256_state.cs b/Scripts/CSSUDII.Sodium.Interop/Generated/crypto_hash_sha256_state.cs new file mode 100644 index 0000000..c07bbab --- /dev/null +++ b/Scripts/CSSUDII.Sodium.Interop/Generated/crypto_hash_sha256_state.cs @@ -0,0 +1,28 @@ +using System.Runtime.CompilerServices; + +namespace CSSUDII.Sodium.Interop +{ + public partial struct crypto_hash_sha256_state + { + [NativeTypeName("uint32_t[8]")] + public _state_e__FixedBuffer state; + + [NativeTypeName("uint64_t")] + public ulong count; + + [NativeTypeName("uint8_t[64]")] + public _buf_e__FixedBuffer buf; + + [InlineArray(8)] + public partial struct _state_e__FixedBuffer + { + public uint e0; + } + + [InlineArray(64)] + public partial struct _buf_e__FixedBuffer + { + public byte e0; + } + } +} diff --git a/Scripts/CSSUDII.Sodium.Interop/Generated/crypto_hash_sha512_state.cs b/Scripts/CSSUDII.Sodium.Interop/Generated/crypto_hash_sha512_state.cs new file mode 100644 index 0000000..c0e3e76 --- /dev/null +++ b/Scripts/CSSUDII.Sodium.Interop/Generated/crypto_hash_sha512_state.cs @@ -0,0 +1,34 @@ +using System.Runtime.CompilerServices; + +namespace CSSUDII.Sodium.Interop +{ + public partial struct crypto_hash_sha512_state + { + [NativeTypeName("uint64_t[8]")] + public _state_e__FixedBuffer state; + + [NativeTypeName("uint64_t[2]")] + public _count_e__FixedBuffer count; + + [NativeTypeName("uint8_t[128]")] + public _buf_e__FixedBuffer buf; + + [InlineArray(8)] + public partial struct _state_e__FixedBuffer + { + public ulong e0; + } + + [InlineArray(2)] + public partial struct _count_e__FixedBuffer + { + public ulong e0; + } + + [InlineArray(128)] + public partial struct _buf_e__FixedBuffer + { + public byte e0; + } + } +} diff --git a/Scripts/CSSUDII.Sodium.Interop/Generated/crypto_onetimeauth_poly1305_state.cs b/Scripts/CSSUDII.Sodium.Interop/Generated/crypto_onetimeauth_poly1305_state.cs new file mode 100644 index 0000000..ecfdf7f --- /dev/null +++ b/Scripts/CSSUDII.Sodium.Interop/Generated/crypto_onetimeauth_poly1305_state.cs @@ -0,0 +1,16 @@ +using System.Runtime.CompilerServices; + +namespace CSSUDII.Sodium.Interop +{ + public partial struct crypto_onetimeauth_poly1305_state + { + [NativeTypeName("unsigned char[256]")] + public _opaque_e__FixedBuffer opaque; + + [InlineArray(256)] + public partial struct _opaque_e__FixedBuffer + { + public byte e0; + } + } +} diff --git a/Scripts/CSSUDII.Sodium.Interop/Generated/crypto_secretstream_xchacha20poly1305_state.cs b/Scripts/CSSUDII.Sodium.Interop/Generated/crypto_secretstream_xchacha20poly1305_state.cs new file mode 100644 index 0000000..98d1cb9 --- /dev/null +++ b/Scripts/CSSUDII.Sodium.Interop/Generated/crypto_secretstream_xchacha20poly1305_state.cs @@ -0,0 +1,34 @@ +using System.Runtime.CompilerServices; + +namespace CSSUDII.Sodium.Interop +{ + public partial struct crypto_secretstream_xchacha20poly1305_state + { + [NativeTypeName("unsigned char[32]")] + public _k_e__FixedBuffer k; + + [NativeTypeName("unsigned char[12]")] + public _nonce_e__FixedBuffer nonce; + + [NativeTypeName("unsigned char[8]")] + public __pad_e__FixedBuffer _pad; + + [InlineArray(32)] + public partial struct _k_e__FixedBuffer + { + public byte e0; + } + + [InlineArray(12)] + public partial struct _nonce_e__FixedBuffer + { + public byte e0; + } + + [InlineArray(8)] + public partial struct __pad_e__FixedBuffer + { + public byte e0; + } + } +} diff --git a/Scripts/CSSUDII.Sodium.Interop/Generated/crypto_sign_ed25519ph_state.cs b/Scripts/CSSUDII.Sodium.Interop/Generated/crypto_sign_ed25519ph_state.cs new file mode 100644 index 0000000..fb0faba --- /dev/null +++ b/Scripts/CSSUDII.Sodium.Interop/Generated/crypto_sign_ed25519ph_state.cs @@ -0,0 +1,7 @@ +namespace CSSUDII.Sodium.Interop +{ + public partial struct crypto_sign_ed25519ph_state + { + public crypto_hash_sha512_state hs; + } +} diff --git a/Scripts/CSSUDII.Sodium.Interop/Generated/randombytes_implementation.cs b/Scripts/CSSUDII.Sodium.Interop/Generated/randombytes_implementation.cs new file mode 100644 index 0000000..ef14fda --- /dev/null +++ b/Scripts/CSSUDII.Sodium.Interop/Generated/randombytes_implementation.cs @@ -0,0 +1,23 @@ +namespace CSSUDII.Sodium.Interop +{ + public unsafe partial struct randombytes_implementation + { + [NativeTypeName("const char *(*)()")] + public delegate* unmanaged[Cdecl] implementation_name; + + [NativeTypeName("uint32_t (*)()")] + public delegate* unmanaged[Cdecl] random; + + [NativeTypeName("void (*)()")] + public delegate* unmanaged[Cdecl] stir; + + [NativeTypeName("uint32_t (*)(const uint32_t)")] + public delegate* unmanaged[Cdecl] uniform; + + [NativeTypeName("void (*)(void *const, const size_t)")] + public delegate* unmanaged[Cdecl] buf; + + [NativeTypeName("int (*)()")] + public delegate* unmanaged[Cdecl] close; + } +} diff --git a/SpaceWizards.Sodium.Interop/Generated/NativeInheritanceAttribute.cs b/SpaceWizards.Sodium.Interop/Generated/NativeInheritanceAttribute.cs deleted file mode 100644 index cfd3e99..0000000 --- a/SpaceWizards.Sodium.Interop/Generated/NativeInheritanceAttribute.cs +++ /dev/null @@ -1,23 +0,0 @@ -using System; -using System.Diagnostics; - -namespace SpaceWizards.Sodium.Interop -{ - /// Defines the base type of a struct as it was in the native signature. - [AttributeUsage(AttributeTargets.Struct, AllowMultiple = false, Inherited = true)] - [Conditional("DEBUG")] - internal sealed partial class NativeInheritanceAttribute : Attribute - { - private readonly string _name; - - /// Initializes a new instance of the class. - /// The name of the base type that was inherited from in the native signature. - public NativeInheritanceAttribute(string name) - { - _name = name; - } - - /// Gets the name of the base type that was inherited from in the native signature. - public string Name => _name; - } -} diff --git a/SpaceWizards.Sodium.Interop/Generated/SetsLastSystemErrorAttribute.cs b/SpaceWizards.Sodium.Interop/Generated/SetsLastSystemErrorAttribute.cs deleted file mode 100644 index 53a4be4..0000000 --- a/SpaceWizards.Sodium.Interop/Generated/SetsLastSystemErrorAttribute.cs +++ /dev/null @@ -1,17 +0,0 @@ -using System; -using System.Diagnostics; -using System.Runtime.InteropServices; - -namespace SpaceWizards.Sodium.Interop -{ - /// Specifies that the given method sets the last system error and it can be retrieved via . - [AttributeUsage(AttributeTargets.Method, AllowMultiple = false, Inherited = true)] - [Conditional("DEBUG")] - internal sealed partial class SetsLastSystemErrorAttribute : Attribute - { - /// Initializes a new instance of the class. - public SetsLastSystemErrorAttribute() - { - } - } -} diff --git a/SpaceWizards.Sodium.Interop/Generated/VtblIndexAttribute.cs b/SpaceWizards.Sodium.Interop/Generated/VtblIndexAttribute.cs deleted file mode 100644 index d449a0e..0000000 --- a/SpaceWizards.Sodium.Interop/Generated/VtblIndexAttribute.cs +++ /dev/null @@ -1,23 +0,0 @@ -using System; -using System.Diagnostics; - -namespace SpaceWizards.Sodium.Interop -{ - /// Defines the vtbl index of a method as it was in the native signature. - [AttributeUsage(AttributeTargets.Method, AllowMultiple = false, Inherited = true)] - [Conditional("DEBUG")] - internal sealed partial class VtblIndexAttribute : Attribute - { - private readonly uint _index; - - /// Initializes a new instance of the class. - /// The vtbl index of a method as it was in the native signature. - public VtblIndexAttribute(uint index) - { - _index = index; - } - - /// Gets the vtbl index of a method as it was in the native signature. - public uint Index => _index; - } -} diff --git a/SpaceWizards.Sodium.Interop/Generated/crypto_aead_aes256gcm_state.cs b/SpaceWizards.Sodium.Interop/Generated/crypto_aead_aes256gcm_state.cs deleted file mode 100644 index 486dbdd..0000000 --- a/SpaceWizards.Sodium.Interop/Generated/crypto_aead_aes256gcm_state.cs +++ /dev/null @@ -1,8 +0,0 @@ -namespace SpaceWizards.Sodium.Interop -{ - public unsafe partial struct crypto_aead_aes256gcm_state - { - [NativeTypeName("unsigned char [512]")] - public fixed byte opaque[512]; - } -} diff --git a/SpaceWizards.Sodium.Interop/Generated/crypto_generichash_blake2b_state.cs b/SpaceWizards.Sodium.Interop/Generated/crypto_generichash_blake2b_state.cs deleted file mode 100644 index ca619fd..0000000 --- a/SpaceWizards.Sodium.Interop/Generated/crypto_generichash_blake2b_state.cs +++ /dev/null @@ -1,8 +0,0 @@ -namespace SpaceWizards.Sodium.Interop -{ - public unsafe partial struct crypto_generichash_blake2b_state - { - [NativeTypeName("unsigned char [384]")] - public fixed byte opaque[384]; - } -} diff --git a/SpaceWizards.Sodium.Interop/Generated/crypto_hash_sha256_state.cs b/SpaceWizards.Sodium.Interop/Generated/crypto_hash_sha256_state.cs deleted file mode 100644 index 5c4186d..0000000 --- a/SpaceWizards.Sodium.Interop/Generated/crypto_hash_sha256_state.cs +++ /dev/null @@ -1,14 +0,0 @@ -namespace SpaceWizards.Sodium.Interop -{ - public unsafe partial struct crypto_hash_sha256_state - { - [NativeTypeName("uint32_t [8]")] - public fixed uint state[8]; - - [NativeTypeName("uint64_t")] - public ulong count; - - [NativeTypeName("uint8_t [64]")] - public fixed byte buf[64]; - } -} diff --git a/SpaceWizards.Sodium.Interop/Generated/crypto_hash_sha512_state.cs b/SpaceWizards.Sodium.Interop/Generated/crypto_hash_sha512_state.cs deleted file mode 100644 index 975506d..0000000 --- a/SpaceWizards.Sodium.Interop/Generated/crypto_hash_sha512_state.cs +++ /dev/null @@ -1,14 +0,0 @@ -namespace SpaceWizards.Sodium.Interop -{ - public unsafe partial struct crypto_hash_sha512_state - { - [NativeTypeName("uint64_t [8]")] - public fixed ulong state[8]; - - [NativeTypeName("uint64_t [2]")] - public fixed ulong count[2]; - - [NativeTypeName("uint8_t [128]")] - public fixed byte buf[128]; - } -} diff --git a/SpaceWizards.Sodium.Interop/Generated/crypto_onetimeauth_poly1305_state.cs b/SpaceWizards.Sodium.Interop/Generated/crypto_onetimeauth_poly1305_state.cs deleted file mode 100644 index 3584d5e..0000000 --- a/SpaceWizards.Sodium.Interop/Generated/crypto_onetimeauth_poly1305_state.cs +++ /dev/null @@ -1,8 +0,0 @@ -namespace SpaceWizards.Sodium.Interop -{ - public unsafe partial struct crypto_onetimeauth_poly1305_state - { - [NativeTypeName("unsigned char [256]")] - public fixed byte opaque[256]; - } -} diff --git a/SpaceWizards.Sodium.Interop/Generated/crypto_secretstream_xchacha20poly1305_state.cs b/SpaceWizards.Sodium.Interop/Generated/crypto_secretstream_xchacha20poly1305_state.cs deleted file mode 100644 index ee4d59c..0000000 --- a/SpaceWizards.Sodium.Interop/Generated/crypto_secretstream_xchacha20poly1305_state.cs +++ /dev/null @@ -1,14 +0,0 @@ -namespace SpaceWizards.Sodium.Interop -{ - public unsafe partial struct crypto_secretstream_xchacha20poly1305_state - { - [NativeTypeName("unsigned char [32]")] - public fixed byte k[32]; - - [NativeTypeName("unsigned char [12]")] - public fixed byte nonce[12]; - - [NativeTypeName("unsigned char [8]")] - public fixed byte _pad[8]; - } -} diff --git a/SpaceWizards.Sodium.Interop/crypto_aead_aes256gcm_state.Manual.cs b/SpaceWizards.Sodium.Interop/crypto_aead_aes256gcm_state.Manual.cs deleted file mode 100644 index e4d49a3..0000000 --- a/SpaceWizards.Sodium.Interop/crypto_aead_aes256gcm_state.Manual.cs +++ /dev/null @@ -1,10 +0,0 @@ -namespace SpaceWizards.Sodium.Interop; - -/// -/// WARNING: This type MUST be aligned to a 16-byte boundary. -/// .NET does not currently have a method of specifying this at the type level, -/// so you need to manage this yourself when allocating space or such. -/// -public unsafe partial struct crypto_aead_aes256gcm_state -{ -} \ No newline at end of file diff --git a/SpaceWizards.Sodium.Interop/crypto_generichash_blake2b_state.Manual.cs b/SpaceWizards.Sodium.Interop/crypto_generichash_blake2b_state.Manual.cs deleted file mode 100644 index 978594b..0000000 --- a/SpaceWizards.Sodium.Interop/crypto_generichash_blake2b_state.Manual.cs +++ /dev/null @@ -1,10 +0,0 @@ -namespace SpaceWizards.Sodium.Interop; - -/// -/// WARNING: This type MUST be aligned to a 64-byte boundary. -/// .NET does not currently have a method of specifying this at the type level, -/// so you need to manage this yourself when allocating space or such. -/// -public unsafe partial struct crypto_generichash_blake2b_state -{ -} \ No newline at end of file diff --git a/SpaceWizards.Sodium.Interop/crypto_onetimeauth_poly1305_state.Manual.cs b/SpaceWizards.Sodium.Interop/crypto_onetimeauth_poly1305_state.Manual.cs deleted file mode 100644 index 0e8d400..0000000 --- a/SpaceWizards.Sodium.Interop/crypto_onetimeauth_poly1305_state.Manual.cs +++ /dev/null @@ -1,10 +0,0 @@ -namespace SpaceWizards.Sodium.Interop; - -/// -/// WARNING: This type MUST be aligned to a 16-byte boundary. -/// .NET does not currently have a method of specifying this at the type level, -/// so you need to manage this yourself when allocating space or such. -/// -public unsafe partial struct crypto_onetimeauth_poly1305_state -{ -} \ No newline at end of file