Neuron®
The Neuron® is the basis for the creation of open and secure federated networks for smart societies.
Loading...
Searching...
No Matches
Ed448.cs
1using System;
7
9{
14 {
23 {
24 }
25
33 public Ed448(ScriptNode PrivateKey, int Start, int Length, Expression Expression)
34 : base(new ScriptNode[] { PrivateKey }, argumentTypes1Normal, Start, Length, Expression)
35 {
36 }
37
46 public Ed448(ScriptNode PrivateKey, ScriptNode HashKey, int Start, int Length, Expression Expression)
47 : base(new ScriptNode[] { PrivateKey, HashKey }, new ArgumentType[] { ArgumentType.Normal, ArgumentType.Scalar }, Start, Length, Expression)
48 {
49 }
50
54 public override string FunctionName => nameof(Ed448);
55
59 public override string[] DefaultArgumentNames => new string[] { "PrivateKey" };
60
68 {
69 int c = Arguments.Length;
70
71 if (c == 0)
72 return new ObjectValue(new Edwards448());
73
74 object Obj = Arguments[0].AssociatedObjectValue;
75 if (!(Obj is byte[] PrivateKey))
76 PrivateKey = Convert.FromBase64String(Obj?.ToString());
77
78 if (c == 1)
79 return new ObjectValue(new Edwards448(PrivateKey));
80
81 bool? HashKey = ToBoolean(Arguments[1]);
82 if (!HashKey.HasValue)
83 throw new ScriptRuntimeException("HashKey mst be a boolean value.", this);
84
85 return new ObjectValue(new Edwards448(PrivateKey, HashKey.Value));
86 }
87 }
88}
Creates an Edwards448 Elliptic curve.
Definition: Ed448.cs:14
Ed448(int Start, int Length, Expression Expression)
Creates an Edwards448 Elliptic curve.
Definition: Ed448.cs:21
override string[] DefaultArgumentNames
Default Argument names
Definition: Ed448.cs:59
Ed448(ScriptNode PrivateKey, ScriptNode HashKey, int Start, int Length, Expression Expression)
Creates an Edwards448 Elliptic curve.
Definition: Ed448.cs:46
override IElement Evaluate(IElement[] Arguments, Variables Variables)
Evaluates the function.
Definition: Ed448.cs:67
override string FunctionName
Name of the function
Definition: Ed448.cs:54
Ed448(ScriptNode PrivateKey, int Start, int Length, Expression Expression)
Creates an Edwards448 Elliptic curve.
Definition: Ed448.cs:33
Class managing a script expression.
Definition: Expression.cs:39
Base class for multivariate funcions.
ScriptNode[] Arguments
Function arguments.
static readonly ArgumentType[] argumentTypes0
Zero parameters.
static readonly ArgumentType[] argumentTypes1Normal
One scalar parameter.
Base class for all nodes in a parsed script tree.
Definition: ScriptNode.cs:69
static ? bool ToBoolean(IElement Value)
Tries to convert an element to a boolean value.
Definition: ScriptNode.cs:375
int Length
Length of expression covered by node.
Definition: ScriptNode.cs:101
override string ToString()
Definition: ScriptNode.cs:359
Expression Expression
Expression of which the node is a part.
Definition: ScriptNode.cs:177
int Start
Start position in script expression.
Definition: ScriptNode.cs:92
Collection of variables.
Definition: Variables.cs:25
Edwards448 Elliptic Curve, as defined in RFC7748 and RFC8032: https://tools.ietf.org/html/rfc7748 htt...
Definition: Edwards448.cs:17
Basic interface for all types of elements.
Definition: IElement.cs:20
ArgumentType
Type of parameter used in a function definition or a lambda definition.
Definition: IFunction.cs:9