diff options
Diffstat (limited to 'doc/classes/Crypto.xml')
-rw-r--r-- | doc/classes/Crypto.xml | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/doc/classes/Crypto.xml b/doc/classes/Crypto.xml index a7e7e756c6..7fbb89423d 100644 --- a/doc/classes/Crypto.xml +++ b/doc/classes/Crypto.xml @@ -24,7 +24,7 @@ cert.save("user://generated.crt") # Encryption var data = "Some data" - var encrypted = crypto.encrypt(key, data.to_utf8()) + var encrypted = crypto.encrypt(key, data.to_utf8_buffer()) # Decryption var decrypted = crypto.decrypt(key, encrypted) # Signing @@ -33,7 +33,7 @@ var verified = crypto.verify(HashingContext.HASH_SHA256, data.sha256_buffer(), signature, key) # Checks assert(verified) - assert(data.to_utf8() == decrypted) + assert(data.to_utf8_buffer() == decrypted) [/gdscript] [csharp] using Godot; @@ -56,7 +56,7 @@ _cert.Save("user://generated.crt"); // Encryption string data = "Some data"; - byte[] encrypted = _crypto.Encrypt(_key, data.ToUtf8()); + byte[] encrypted = _crypto.Encrypt(_key, data.ToUtf8Buffer()); // Decryption byte[] decrypted = _crypto.Decrypt(_key, encrypted); // Signing @@ -65,7 +65,7 @@ bool verified = _crypto.Verify(HashingContext.HashType.Sha256, Data.Sha256Buffer(), signature, _key); // Checks Debug.Assert(verified); - Debug.Assert(data.ToUtf8() == decrypted); + Debug.Assert(data.ToUtf8Buffer() == decrypted); } } [/csharp] |