private void ObscuredStringExample() { /* -------------- usage example -------------- */ // hey, Daniele! ;D var regular = "the Goscurry is not a lie ;)"; // obscured <-> regular conversion is implicit ObscuredString obscured = regular; // you can get raw encrypted value at any time // and save it somewhere for example along with encryptionKey char[] encryptionKey; var encryptedValueRaw = obscured.GetEncrypted(out encryptionKey); // to construct new obscured instance from it after loading it back var newObscured = ObscuredString.FromEncrypted(encryptedValueRaw, encryptionKey); // all other obscured types have similar usage pipeline and APIs /* -------------- logs-------------- */ logBuilder.Length = 0; logBuilder.AppendLine("[ ObscuredString example ]"); logBuilder.AppendLine("Original value:\n" + regular); logBuilder.AppendLine("Obscured value in memory:\n" + newObscured.GetEncrypted(out encryptionKey)); Debug.Log(logBuilder); }
private void ObscuredStringExample() { /* -------------- usage example -------------- */ // you can change default crypto key using this method // it will be automatically used by any new ObscuredString // instances and it will be applied to any existing instance // on the value change ObscuredString.SetNewCryptoKey("I LOVE MY GIRLz"); // hey, Daniele! ;D var regular = "the Goscurry is not a lie ;)"; // obscured <-> regular conversion is implicit ObscuredString obscured = regular; // you can get raw encrypted value at any time // and save it somewhere for example var encryptedValueRaw = obscured.GetEncrypted(); // to construct new obscured instance from it after loading it back var newObscured = ObscuredString.FromEncrypted(encryptedValueRaw); // all other obscured types have similar usage pipeline and APIs /* -------------- logs-------------- */ logBuilder.Length = 0; logBuilder.AppendLine("[ ObscuredString example ]"); logBuilder.AppendLine("Original value:\n" + regular); logBuilder.AppendLine("Obscured value in memory:\n" + newObscured.GetEncrypted()); Debug.Log(logBuilder); }