https://github.com/lochrist/unisteg
Unity utilities and a Steganography library
https://github.com/lochrist/unisteg
steganography unity2d
Last synced: 2 months ago
JSON representation
Unity utilities and a Steganography library
- Host: GitHub
- URL: https://github.com/lochrist/unisteg
- Owner: lochrist
- Created: 2018-04-18T01:54:37.000Z (about 7 years ago)
- Default Branch: master
- Last Pushed: 2018-06-01T02:15:28.000Z (almost 7 years ago)
- Last Synced: 2025-01-12T08:42:54.495Z (4 months ago)
- Topics: steganography, unity2d
- Language: C#
- Homepage:
- Size: 33.2 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Unitils
Library containing multiple Unity utilities function and workflows.
## Steganography
This utility namespace implements a simple [steganography](https://en.wikipedia.org/wiki/Steganography) algorithm allowing a user to "hide" data inside a Unity `Texture2D`. Basically it uses the least significant bits of the color channels to hier data.
A quick example can be found in `SteganoCtrl.cs` (used in the `Steganography` scene):
```csharp
void Start () {
sr = gameObject.GetComponent();// Encode secretMsg in a texture. This returns a copy of the texture
encodedTex = Steganography.Encode(sr.sprite.texture, secretMsg);// Set the new texture in our Sprite component
sr.sprite = Sprite.Create(encodedTex, new Rect(0.0f, 0.0f, encodedTex.width, encodedTex.height), new Vector2(0.5f, 0.5f));
}private void OnGUI()
{
GUILayout.BeginHorizontal();isDecoded = GUILayout.Toggle(isDecoded, "Decode");
if (isDecoded)
{
// Decode the secretMsg from the texture
var decodedMsg = Steganography.DecodeAsString(sr.sprite.texture);
GUILayout.Label(decodedMsg);
}
else
{
GUILayout.Label("**********************");
}GUILayout.Button(encodedTex);
GUILayout.EndHorizontal();
}
```### More details
We support multiple ways to encode data depending on how you want to store the data and affect image quality:
```csharp
public enum Format
{
RGB1,
RGB2,
RGBA1,
RGBA2,
A1,
A2
}
```Each stream of data has a 8 bytes header that contains the format the data is written with and the size of the written data.