diff --git a/Scripts/GenBindings.rsp b/Scripts/GenBindings.rsp
index cb8e124..ea40247 100644
--- a/Scripts/GenBindings.rsp
+++ b/Scripts/GenBindings.rsp
@@ -9,7 +9,7 @@ generate-macro-bindings
unix-types
log-potential-typedef-remappings
---exclude
+--exclude
randombytes_salsa20_implementation
CRYPTO_ALIGN
SODIUM_C99
@@ -92,4 +92,7 @@ libsodium
--remap
crypto_aead_aes256gcm_state_=crypto_aead_aes256gcm_state
-crypto_auth_hmacsha512_state=crypto_auth_hmacsha512256_state
\ No newline at end of file
+crypto_auth_hmacsha512_state=crypto_auth_hmacsha512256_state
+
+--methodClassName
+Libsodium
diff --git a/SpaceWizards.Sodium.Interop/Generated/Methods.cs b/SpaceWizards.Sodium.Interop/Generated/Libsodium.cs
similarity index 99%
rename from SpaceWizards.Sodium.Interop/Generated/Methods.cs
rename to SpaceWizards.Sodium.Interop/Generated/Libsodium.cs
index ad9ad13..88ca206 100644
--- a/SpaceWizards.Sodium.Interop/Generated/Methods.cs
+++ b/SpaceWizards.Sodium.Interop/Generated/Libsodium.cs
@@ -3,7 +3,7 @@ using System.Runtime.InteropServices;
namespace SpaceWizards.Sodium.Interop
{
- public static unsafe partial class Methods
+ public static unsafe partial class Libsodium
{
[DllImport("libsodium", CallingConvention = CallingConvention.Cdecl, ExactSpelling = true)]
public static extern int sodium_init();
@@ -2680,6 +2680,15 @@ namespace SpaceWizards.Sodium.Interop
[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")]
public static extern nuint crypto_stream_salsa208_keybytes();
diff --git a/SpaceWizards.Sodium.Interop/SpaceWizards.Sodium.Interop.csproj b/SpaceWizards.Sodium.Interop/SpaceWizards.Sodium.Interop.csproj
index d002e3a..fea139f 100644
--- a/SpaceWizards.Sodium.Interop/SpaceWizards.Sodium.Interop.csproj
+++ b/SpaceWizards.Sodium.Interop/SpaceWizards.Sodium.Interop.csproj
@@ -14,11 +14,11 @@
-
+
-
+
diff --git a/SpaceWizards.Sodium.Tests/SecretBoxTest.cs b/SpaceWizards.Sodium.Tests/SecretBoxTest.cs
index 0b771a8..58e1cf8 100644
--- a/SpaceWizards.Sodium.Tests/SecretBoxTest.cs
+++ b/SpaceWizards.Sodium.Tests/SecretBoxTest.cs
@@ -1,6 +1,6 @@
using System.Security.Cryptography;
using NUnit.Framework;
-using static SpaceWizards.Sodium.Interop.Methods;
+using static SpaceWizards.Sodium.Interop.Libsodium;
namespace SpaceWizards.Sodium.Tests;
@@ -12,10 +12,10 @@ public sealed class SecretBoxTest
{
var message = RandomNumberGenerator.GetBytes(1024);
var cipher = RandomNumberGenerator.GetBytes((int)(1024 + crypto_secretbox_MACBYTES));
-
+
var key = stackalloc byte[(int)crypto_secretbox_KEYBYTES];
var nonce = stackalloc byte[(int)crypto_secretbox_NONCEBYTES];
-
+
crypto_secretbox_keygen(key);
randombytes_buf(nonce, crypto_secretbox_NONCEBYTES);
fixed (byte* mPtr = message)
@@ -30,7 +30,7 @@ public sealed class SecretBoxTest
{
crypto_secretbox_open_easy(dPtr, cPtr, (ulong)cipher.Length, nonce, key);
}
-
+
Assert.That(decrypted, Is.EquivalentTo(message));
}
-}
\ No newline at end of file
+}