-
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
82 additions
and
0 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
using System.Collections; | ||
using System.Collections.Generic; | ||
using NUnit.Framework; | ||
using UnityEngine; | ||
using UnityEngine.TestTools; | ||
|
||
namespace unity.libsodium.test | ||
{ | ||
public class TestSimple | ||
{ | ||
[Test] | ||
public void TestChaCha20() | ||
{ | ||
int x = NativeLibsodium.sodium_init(); | ||
Assert.True(x == 0 || x == 1); | ||
|
||
const string MESSAGE = "Test message to encrypt"; | ||
byte[] nonce = StreamEncryption.GenerateNonceChaCha20(); | ||
byte[] key = StreamEncryption.GenerateKey(); | ||
|
||
//encrypt it | ||
byte[] encrypted = StreamEncryption.EncryptChaCha20(MESSAGE, nonce, key); | ||
|
||
|
||
//decrypt it | ||
byte[] decrypted = StreamEncryption.DecryptChaCha20(encrypted, nonce, key); | ||
|
||
Assert.AreEqual(MESSAGE, decrypted); | ||
} | ||
|
||
} | ||
} |
11 changes: 11 additions & 0 deletions
11
unity.libsodium/Assets/unity.libsodium.test/TestSimple.cs.meta
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
24 changes: 24 additions & 0 deletions
24
unity.libsodium/Assets/unity.libsodium.test/unity.libsodium.test.asmdef
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
{ | ||
"name": "unity.libsodium.test", | ||
"rootNamespace": "unity.libsodium.test", | ||
"references": [ | ||
"UnityEngine.TestRunner", | ||
"UnityEditor.TestRunner", | ||
"unity.libsodium" | ||
], | ||
"includePlatforms": [ | ||
"Editor" | ||
], | ||
"excludePlatforms": [], | ||
"allowUnsafeCode": false, | ||
"overrideReferences": true, | ||
"precompiledReferences": [ | ||
"nunit.framework.dll" | ||
], | ||
"autoReferenced": false, | ||
"defineConstraints": [ | ||
"UNITY_INCLUDE_TESTS" | ||
], | ||
"versionDefines": [], | ||
"noEngineReferences": false | ||
} |
7 changes: 7 additions & 0 deletions
7
unity.libsodium/Assets/unity.libsodium.test/unity.libsodium.test.asmdef.meta
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.