Skip to content

Commit

Permalink
unity.libsodium 0.2.0 - (libsodium version 1.0.18)
Browse files Browse the repository at this point in the history
  • Loading branch information
netpyoung committed Nov 21, 2021
1 parent bade42f commit 92d9a5e
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 19 deletions.
27 changes: 9 additions & 18 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,30 +11,21 @@

## installation

- [Download this .unitypackage from Release Page](https://github.com/netpyoung/unity.libsodium/releases)

## Example

``` csharp
var x = NativeLibsodium.sodium_init();
Debug.Log (x);
## using .unitypackage

- [Download this .unitypackage from Release Page](https://github.com/netpyoung/unity.libsodium/releases)

const string MESSAGE = "Test message to encrypt";
var nonce = StreamEncryption.GenerateNonceChaCha20();
var key = StreamEncryption.GenerateKey();
## using UPM

//encrypt it
var encrypted = StreamEncryption.EncryptChaCha20(MESSAGE, nonce, key);
using #{version} for versioning.

``` json
"com.netpyoung.libsodium": "https://github.com/netpyoung/unity.libsodium.git?path=unity.libsodium/Assets/unity.libsodium#0.2.0"
```

//decrypt it
var decrypted = StreamEncryption.DecryptChaCha20(encrypted, nonce, key);
## Example

Debug.Log (MESSAGE);
Debug.Log (Encoding.UTF8.GetString(encrypted));
Debug.Log (Encoding.UTF8.GetString(decrypted));
```
- check [unity.libsodium.test](https://github.com/netpyoung/unity.libsodium/tree/master/unity.libsodium/Assets/unity.libsodium.test)

## License

Expand Down
11 changes: 11 additions & 0 deletions unity.libsodium/Assets/unity.libsodium/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"name": "com.netpyoung.libsodium",
"displayName": "Unity.LibSodium",
"version": "0.2.0",
"unity": "2018.4",
"description": "libsodium made easy for Unity3d.",
"keywords": [ "libsodium", "unity.libsodium" ],
"license": "MIT",
"category": "crypto",
"dependencies": {}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ public class PackageTool
[MenuItem("Package/Update Package")]
private static void UpdatePackage()
{
const string VERSION = "0.1.0";
const string VERSION = "0.2.0";
AssetDatabase.ExportPackage(
new[] {"Assets/unity.libsodium"},
$"../unity.libsodium-{VERSION}.unitypackage",
Expand Down

0 comments on commit 92d9a5e

Please sign in to comment.