This is Cipher Libraries in Unity, include the AESCipher and RSACipher.
UnityCipher can be implemented AES encryption(Exactly, Rijndael cipher, not AES cryptography) and RSA encryption simply and high secure, in Unity(C#).
-
If you want to download a unitypackage, you can download from Releases.
-
If you want use the UPM, you add below to
Packages/manifest.json
.
{
"dependencies": {
"net.taptappun.taku.kobayashi.unitycipher": "https://github.com/TakuKobayashi/UnityCipher.git?path=/Assets/UnityCipher",
...
}
}
or input the url https://github.com/TakuKobayashi/UnityCipher.git?path=/Assets/UnityCipher
to Add package from git URL
(Window
-> PackageManager
like this.)
For detail, look to UnityCipher/Examples/
And also, add using UnityCipher
, you can use UnityCipher.
You can encrypt it by calling the following method.
string encrypted = RijndaelEncryption.Encrypt(plainText, passwordText);
plainText
can also use byte[]
as well as string.
If you use byte[]
, give the encritpted byte[]
, like this.
byte[] encrypted = RijndaelEncryption.Encrypt(plainBinary, passwordText);
You can decrypt it by calling the following method.
string plainText = RijndaelEncryption.Decrypt(encryptedText, passwordText);
If you can successfully decrypt the encrypted one, you can get the decrypted one.
plainText
can also use byte[]
as well as string.
If you use byte[]
, give the decrypted byte[]
, like this.
byte[] plainBinary = RijndaelEncryption.Decrypt(encryptedBinary, passwordText);