Esempio n. 1
0
        private static byte[] GetSBox(Gost28147SBox sBox)
        {
            switch (sBox)
            {
            case Gost28147SBox.Default: return(null);

            case Gost28147SBox.D_Test: return(Gost28147Engine.GetSBox("D-Test"));

            case Gost28147SBox.D_A: return(Gost28147Engine.GetSBox("D-A"));

            case Gost28147SBox.E_Test: return(Gost28147Engine.GetSBox("E-Test"));

            case Gost28147SBox.E_A: return(Gost28147Engine.GetSBox("E-A"));

            case Gost28147SBox.E_B: return(Gost28147Engine.GetSBox("E-B"));

            case Gost28147SBox.E_C: return(Gost28147Engine.GetSBox("E-C"));

            case Gost28147SBox.E_D: return(Gost28147Engine.GetSBox("E-D"));

            default: throw new CryptographicException("Unsupported substitution box.");
            }
        }
Esempio n. 2
0
        /// <summary>
        /// GOST3411.
        /// <para/>Legal hash size 256 bits.
        /// <para/>Uses substitution box "D-A" by default.
        /// </summary>
        /// <param name="sBox">Substitution box.</param>

        public GOST3411(Gost28147SBox sBox) : this(GetSBox(sBox))
        {
        }