Esempio n. 1
0
 /// <summary>
 /// Optionally initialises the Skein digest with the provided parameters.
 /// </summary>
 /// See <see cref="SkeinParameters"></see> for details on the parameterisation of the Skein hash function.
 /// <param name="skeinParameters">the parameters to apply to this engine, or <code>null</code> to use no parameters.</param>
 public void Init(SkeinParameters skeinParameters)
 {
     if (skeinParameters.GetKey() == null)
     {
         throw new ArgumentException("Skein MAC requires a key parameter.");
     }
     engine.Init(skeinParameters);
 }
Esempio n. 2
0
        /// <summary>
        /// Initialises the Skein engine with the provided parameters. See <see cref="SkeinParameters"/> for
        /// details on the parameterisation of the Skein hash function.
        /// </summary>
        /// <param name="parameters">the parameters to apply to this engine, or <code>null</code> to use no parameters.</param>
        public void Init(SkeinParameters parameters)
        {
            this.chain = null;
            this.key   = null;
            this.preMessageParameters  = null;
            this.postMessageParameters = null;

            if (parameters != null)
            {
                byte[] key = parameters.GetKey();
                if (key.Length < 16)
                {
                    throw new ArgumentException("Skein key must be at least 128 bits.");
                }
                InitParams(parameters.GetParameters());
            }
            CreateInitialState();

            // Initialise message block
            UbiInit(PARAM_TYPE_MESSAGE);
        }