Skip to content

Commit

Permalink
Fix invalid C# in crypto docs
Browse files Browse the repository at this point in the history
  • Loading branch information
raulsntos committed Sep 15, 2022
1 parent 20d6672 commit d762500
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 9 deletions.
1 change: 1 addition & 0 deletions doc/classes/AESContext.xml
Expand Up @@ -45,6 +45,7 @@
public class Example : Node
{
public AESContext Aes = new AESContext();

public override void _Ready()
{
string key = "My secret key!!!"; // Key must be either 16 or 32 bytes.
Expand Down
18 changes: 9 additions & 9 deletions doc/classes/HMACContext.xml
Expand Up @@ -32,22 +32,22 @@
public class CryptoNode : Node
{
private HMACContext ctx = new HMACContext();

public override void _Ready()
{
PackedByteArray key = String("supersecret").to_utf8();
Error err = ctx.Start(HashingContext.HASH_SHA256, key);
GD.Assert(err == OK);
PackedByteArray msg1 = String("this is ").to_utf8();
PackedByteArray msg2 = String("super duper secret").to_utf8();
byte[] key = "supersecret".ToUTF8();
Error err = ctx.Start(HashingContext.HashType.Sha256, key);
Debug.Assert(err == Error.Ok);
byte[] msg1 = "this is ".ToUTF8();
byte[] msg2 = "super duper secret".ToUTF8();
err = ctx.Update(msg1);
GD.Assert(err == OK);
Debug.Assert(err == Error.Ok);
err = ctx.Update(msg2);
GD.Assert(err == OK);
PackedByteArray hmac = ctx.Finish();
Debug.Assert(err == Error.Ok);
byte[] hmac = ctx.Finish();
GD.Print(hmac.HexEncode());
}
}

[/csharp]
[/codeblocks]
</description>
Expand Down

0 comments on commit d762500

Please sign in to comment.