Dogan Kirnaz
  • Welcome
  • Setup
    • Quickstart
  • Basics
    • Agent Extensions
    • Audio Extensions
    • Camera Extensions
    • Collision Extensions
    • Coroutine Extensions
    • Encryption Extensions
    • Format Extensions
    • Game Extensions
    • Json Extensions
    • List Extensions
    • Loop Extensions
    • Material Extensions
    • Math Extensions
    • GameObject Extensions
    • Physics Extensions
    • Object Pool Extensions
    • Scene Extensions
    • PlayerPrefs Extensions
  • Support
    • Support
Powered by GitBook
On this page
  1. Basics

Encryption Extensions

Encrypt

This line calls the Encrypt extension method to encrypt the string sensitiveData. The resulting encrypted string is logged for debugging purposes.

string sensitiveData = "PlayerPassword: secret123";
string encryptedData = EncryptExtensions.Encrypt(sensitiveData);

Debug.Log("Encrypted Data: " + encryptedData);

Encrypt with Custom Key

This example shows how to encrypt data using a custom encryption key. The resulting encrypted string is logged for debugging.

string sensitiveData = "PlayerPassword: secret123";
string encryptedData = EncryptExtensions.Encrypt(sensitiveData, "YOUR_CUSTOM_KEY");

Debug.Log("Encrypted Data with Custom Key: " + encryptedData);

Decrypt

This line calls the Decrypt extension method to decrypt the previously encrypted string. The result, which should match the original sensitive data, is logged for verification.

string decryptedData = EncryptExtensions.Decrypt(encryptedData);

Debug.Log("Decrypted Data: " + decryptedData);

Decrypt with Custom Key

This demonstrates how to decrypt data that was encrypted with a custom key, ensuring that the same key is used for successful decryption. The decrypted result is logged for verification.

string decryptedData = EncryptExtensions.Decrypt(encryptedData, "YOUR_CUSTOM_KEY");

Debug.Log("Decrypted Data with Custom Key: " + decryptedData);
PreviousCoroutine ExtensionsNextFormat Extensions

Last updated 24 days ago