Neuron®
The Neuron® is the basis for the creation of open and secure federated networks for smart societies.
Loading...
Searching...
No Matches
Sha2_512HMac.cs
1using System;
2using System.Collections.Generic;
8
10{
15 {
25 : base(Data, Key, Start, Length, Expression)
26 {
27 }
28
32 public override string FunctionName => nameof(Sha2_512HMac);
33
42 {
43 if (!(Argument1.AssociatedObjectValue is byte[] Data))
44 throw new ScriptRuntimeException("Binary data expected.", this);
45
46 if (!(Argument2.AssociatedObjectValue is byte[] Key))
47 throw new ScriptRuntimeException("Binary key expected.", this);
48
49 return new ObjectValue(Hashes.ComputeHMACSHA512Hash(Key, Data));
50 }
51
52 }
53}
override IElement Evaluate(IElement Argument1, IElement Argument2, Variables Variables)
Evaluates the function.
Definition: Sha2_512HMac.cs:41
Sha2_512HMac(ScriptNode Data, ScriptNode Key, int Start, int Length, Expression Expression)
Sha2_512HMac(Data)
Definition: Sha2_512HMac.cs:24
Class managing a script expression.
Definition: Expression.cs:39
Base class for funcions of one variable.
ScriptNode Argument2
Function argument 2.
ScriptNode Argument1
Function argument 1.
Base class for all nodes in a parsed script tree.
Definition: ScriptNode.cs:69
int Length
Length of expression covered by node.
Definition: ScriptNode.cs:101
int Start
Start position in script expression.
Definition: ScriptNode.cs:92
Collection of variables.
Definition: Variables.cs:25
Contains methods for simple hash calculations.
Definition: Hashes.cs:59
static byte[] ComputeHMACSHA512Hash(byte[] Key, byte[] Data)
Computes the HMAC-SHA-512 hash of a block of binary data.
Definition: Hashes.cs:643
Basic interface for all types of elements.
Definition: IElement.cs:20