示例#1
0
        /// <summary>
        /// Evaluates the function.
        /// </summary>
        /// <param name="Argument1">Function argument 1.</param>
        /// <param name="Argument2">Function argument 2.</param>
        /// <param name="Variables">Variables collection.</param>
        /// <returns>Function result.</returns>
        public override IElement Evaluate(IElement Argument1, IElement Argument2, Variables Variables)
        {
            if (!(Argument1.AssociatedObjectValue is byte[] Data))
            {
                throw new ScriptRuntimeException("Binary data expected.", this);
            }

            if (!(Argument2.AssociatedObjectValue is byte[] Key))
            {
                throw new ScriptRuntimeException("Binary key expected.", this);
            }

            return(new ObjectValue(Hashes.ComputeHMACSHA384Hash(Key, Data)));
        }