https://github.com/dubit/unity-crypto
AES encryption / decryption functions
https://github.com/dubit/unity-crypto
Last synced: 3 months ago
JSON representation
AES encryption / decryption functions
- Host: GitHub
- URL: https://github.com/dubit/unity-crypto
- Owner: dubit
- Created: 2018-06-07T12:45:01.000Z (about 8 years ago)
- Default Branch: master
- Last Pushed: 2018-06-07T16:03:32.000Z (about 8 years ago)
- Last Synced: 2025-04-07T14:53:11.093Z (over 1 year ago)
- Language: C#
- Size: 3.91 KB
- Stars: 30
- Watchers: 5
- Forks: 2
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# unity-crypto
## What is it?
A library containing classes for encrypting and decrypting data.
Features:
* AES encryption and decryption of string (and/or serialized) data
## How to use it.
Call directly from code: SimpleAESEncryption.Encrypt and SimpleAESEncryption.Decrypt
## How does AES encryption work?
When encrypting some plaintext with a password using AES, both encrypted text, and a unique 'IV' (initialisation vector) are produced.
The IV is a unique 'key' which ensures that the encrypted output is randomised, and refers only to that instance of encrypted output. Otherwise, two inputs starting with the same data, end encrypted with the same password, would have similarities in their encrypted data, making it easier to guess their contents and break the encryption. Most importantly, to decrypt the encrypted data, both the password (which may be shared between multiple inputs), and the IV (which is unique to that instance of encrypted data), are required.
Plaintext + Password --> Encrypted + IV
Encrypted + Password + IV --> Plaintext
### AESEncryptedText
This is a small struct representing some encrypted text, and the IV which was generated when it was encrypted. Both these values must be used when decrypting the encrypted text.