Esempio n. 1
0
 private void CopyIn(SkeinEngine engine)
 {
     this.ubi.Reset(engine.ubi);
     this.chain                 = engine.chain.DeepCopy();
     this.initialState          = engine.initialState.DeepCopy();
     this.key                   = engine.key.DeepCopy();
     this.preMessageParameters  = Clone(engine.preMessageParameters, this.preMessageParameters);
     this.postMessageParameters = Clone(engine.postMessageParameters, this.postMessageParameters);
 }
Esempio n. 2
0
        public void Reset(IMemoable other)
        {
            SkeinEngine s = (SkeinEngine)other;

            if ((BlockSize != s.BlockSize) || (outputSizeBytes != s.outputSizeBytes))
            {
                throw new MemoableResetException("Incompatible parameters in provided SkeinEngine.");
            }
            CopyIn(s);
        }
Esempio n. 3
0
 public SkeinMac(SkeinMac mac)
 {
     this.engine = new SkeinEngine(mac.engine);
 }
Esempio n. 4
0
 /// <summary>
 /// Constructs a Skein MAC with an internal state size and output size.
 /// </summary>
 /// <param name="stateSizeBits">the internal state size in bits - one of <see cref="SKEIN_256"/> <see cref="SKEIN_512"/> or
 ///                       <see cref="SKEIN_1024"/>.</param>
 /// <param name="digestSizeBits">the output/MAC size to produce in bits, which must be an integral number of
 ///                      bytes.</param>
 public SkeinMac(int stateSizeBits, int digestSizeBits)
 {
     this.engine = new SkeinEngine(stateSizeBits, digestSizeBits);
 }
Esempio n. 5
0
 /// <summary>
 /// Creates a SkeinEngine as an exact copy of an existing instance.
 /// </summary>
 public SkeinEngine(SkeinEngine engine)
     : this(engine.BlockSize * 8, engine.OutputSize * 8)
 {
     CopyIn(engine);
 }
Esempio n. 6
0
 public UBI(SkeinEngine engine, int blockSize)
 {
     this.engine  = engine;
     currentBlock = new byte[blockSize];
     message      = new ulong[currentBlock.Length / 8];
 }
Esempio n. 7
0
 public SkeinDigest(SkeinDigest digest)
 {
     this.engine = new SkeinEngine(digest.engine);
 }
Esempio n. 8
0
 /// <summary>
 /// Constructs a Skein digest with an internal state size and output size.
 /// </summary>
 /// <param name="stateSizeBits">the internal state size in bits - one of <see cref="SKEIN_256"/> <see cref="SKEIN_512"/> or
 ///                       <see cref="SKEIN_1024"/>.</param>
 /// <param name="digestSizeBits">the output/digest size to produce in bits, which must be an integral number of
 ///                      bytes.</param>
 public SkeinDigest(int stateSizeBits, int digestSizeBits)
 {
     this.engine = new SkeinEngine(stateSizeBits, digestSizeBits);
     Init(null);
 }