diff options
author | David Hook <dgh@bouncycastle.org> | 2017-07-06 19:51:10 +1000 |
---|---|---|
committer | David Hook <dgh@bouncycastle.org> | 2017-07-06 19:51:10 +1000 |
commit | 7ea555ece02dc76d2e668f1f4fcc7a9bc6a736ed (patch) | |
tree | 3ef85e5c93961e7a83a7c76ba696d45931dc3d5d /crypto | |
parent | added KCTR (diff) | |
download | BouncyCastle.NET-ed25519-7ea555ece02dc76d2e668f1f4fcc7a9bc6a736ed.tar.xz |
refactored out key size
Diffstat (limited to 'crypto')
-rw-r--r-- | crypto/src/crypto/engines/Dstu7624Engine.cs | 285 | ||||
-rw-r--r-- | crypto/src/crypto/engines/Dstu7624WrapEngine.cs | 4 | ||||
-rw-r--r-- | crypto/src/crypto/macs/DSTU7624Mac.cs | 4 | ||||
-rw-r--r-- | crypto/src/crypto/util/Pack.cs | 9 | ||||
-rw-r--r-- | crypto/test/src/crypto/test/DSTU7624Test.cs | 68 |
5 files changed, 186 insertions, 184 deletions
diff --git a/crypto/src/crypto/engines/Dstu7624Engine.cs b/crypto/src/crypto/engines/Dstu7624Engine.cs index 4699ee5bd..422b5574a 100644 --- a/crypto/src/crypto/engines/Dstu7624Engine.cs +++ b/crypto/src/crypto/engines/Dstu7624Engine.cs @@ -3,6 +3,7 @@ using System.Collections; using Org.BouncyCastle.Crypto.Parameters; using Org.BouncyCastle.Utilities; +using Org.BouncyCastle.Crypto.Utilities; namespace Org.BouncyCastle.Crypto.Engines { @@ -12,133 +13,124 @@ namespace Org.BouncyCastle.Crypto.Engines public class Dstu7624Engine : IBlockCipher { - private const int BITS_IN_WORD = 64; - private const int BITS_IN_BYTE = 8; + private static readonly int BITS_IN_WORD = 64; + private static readonly int BITS_IN_BYTE = 8; - /* Block words size. */ - private const int kNB_128 = 2; - private const int kNB_256 = 4; - private const int kNB_512 = 8; + private static readonly int REDUCTION_POLYNOMIAL = 0x011d; /* x^8 + x^4 + x^3 + x^2 + 1 */ - /* Key words size. */ - private const int kNK_128 = 2; - private const int kNK_256 = 4; - private const int kNK_512 = 8; + private ulong[] internalState; + private ulong[] workingKey; + private ulong[][] roundKeys; - /* Block bits size. */ - private const int kBLOCK_128 = kNB_128 * BITS_IN_WORD; - private const int kBLOCK_256 = kNB_256 * BITS_IN_WORD; - private const int kBLOCK_512 = kNB_512 * BITS_IN_WORD; + /* Number of 64-bit words in block */ + private int wordsInBlock; - /* Block bits size. */ - private const int kKEY_128 = kNK_128 * BITS_IN_WORD; - private const int kKEY_256 = kNK_256 * BITS_IN_WORD; - private const int kKEY_512 = kNK_512 * BITS_IN_WORD; - - /* Number of enciphering rounds size depending on key length. */ - private const int kNR_128 = 10; - private const int kNR_256 = 14; - private const int kNR_512 = 18; - - private const int REDUCTION_POLYNOMIAL = 0x011d; /* x^8 + x^4 + x^3 + x^2 + 1 */ - - - private int nb; /* Number of 64-bit words in enciphering block. */ - private int nk; /*< Number of 64-bit words in key. */ - private int roundKeysAmount; /*< Number of enciphering rounds. */ - - private ulong[] internalState = null; /*< Current cipher state. */ - - - private ulong[] workingKey = null; - private ulong[][] roundKeys = null; /*< Round key computed from enciphering key. */ + /* Number of 64-bit words in key */ + private int wordsInKey; + /* Number of encryption rounds depending on key length */ + private static int ROUNDS_128 = 10; + private static int ROUNDS_256 = 14; + private static int ROUNDS_512 = 18; private int blockSizeBits; - private int keySizeBits; + private int roundsAmount; private bool forEncryption; + private byte[] internalStateBytes; + private byte[] tempInternalStateBytes; - public Dstu7624Engine(int blockSizeBits, int keySizeBits) + public Dstu7624Engine(int blockSizeBits) { - this.blockSizeBits = blockSizeBits; - this.keySizeBits = keySizeBits; - - if (blockSizeBits == kBLOCK_128) + /* DSTU7624 supports 128 | 256 | 512 key/block sizes */ + if (blockSizeBits != 128 && blockSizeBits != 256 && blockSizeBits != 512) { - nb = kBLOCK_128 / BITS_IN_WORD; - if (keySizeBits == kKEY_128) - { - nk = kKEY_128 / BITS_IN_WORD; - roundKeysAmount = kNR_128; - } - else if (keySizeBits == kKEY_256) - { - nk = kKEY_256 / BITS_IN_WORD; - roundKeysAmount = kNR_256; - } - else - { - throw new ArgumentException("Unsupported key size"); - } + throw new ArgumentException("Unsupported block length: only 128/256/512 are allowed"); } - else if (blockSizeBits == 256) + this.blockSizeBits = blockSizeBits; + + wordsInBlock = blockSizeBits / BITS_IN_WORD; + internalState = new ulong[wordsInBlock]; + + internalStateBytes = new byte[internalState.Length * 64 / BITS_IN_BYTE]; + tempInternalStateBytes = new byte[internalState.Length * 64 / BITS_IN_BYTE]; + } + + #region INITIALIZATION + public virtual void Init(bool forEncryption, ICipherParameters parameters) + { + if (parameters is KeyParameter) { - nb = kBLOCK_256 / BITS_IN_WORD; - if (keySizeBits == kKEY_256) + this.forEncryption = forEncryption; + + byte[] keyBytes = ((KeyParameter)parameters).GetKey(); + int keyBitLength = keyBytes.Length * BITS_IN_BYTE; + int blockBitLength = wordsInBlock * BITS_IN_WORD; + + if (keyBitLength != 128 && keyBitLength != 256 && keyBitLength != 512) { - nk = kKEY_256 / BITS_IN_WORD; - roundKeysAmount = kNR_256; + throw new ArgumentException("unsupported key length: only 128/256/512 are allowed"); } - else if (keySizeBits == kKEY_512) + + /* Limitations on key lengths depending on block lengths. See table 6.1 in standard */ + if (blockBitLength == 128) { - nk = kKEY_512 / BITS_IN_WORD; - roundKeysAmount = kNR_512; + if (keyBitLength == 512) + { + throw new ArgumentException("Unsupported key length"); + } } - else + + if (blockBitLength == 256) { - throw new ArgumentException("Unsupported key size"); + if (keyBitLength == 128) + { + throw new ArgumentException("Unsupported key length"); + } } - } - else if (blockSizeBits == kBLOCK_512) - { - nb = kBLOCK_512 / BITS_IN_WORD; - if (keySizeBits == kKEY_512) + + if (blockBitLength == 512) { - nk = kKEY_512 / BITS_IN_WORD; - roundKeysAmount = kNR_512; + if (keyBitLength != 512) + { + throw new ArgumentException("Unsupported key length"); + } } - else + + switch (keyBitLength) { - throw new ArgumentException("Unsupported key size"); + case 128: + roundsAmount = ROUNDS_128; + break; + case 256: + roundsAmount = ROUNDS_256; + break; + case 512: + roundsAmount = ROUNDS_512; + break; } - } - else - { - throw new ArgumentException("Unsupported block size"); - } - internalState = new ulong[nb]; + wordsInKey = keyBitLength / BITS_IN_WORD; - roundKeys = new ulong[roundKeysAmount + 1][]; - - for (int i = 0; i < roundKeysAmount + 1; i++) - { - roundKeys[i] = new ulong[nb]; - } - } + /* +1 round key as defined in standard */ + roundKeys = new ulong[roundsAmount + 1][]; + for (int roundKeyIndex = 0; roundKeyIndex < roundKeys.Length; roundKeyIndex++) + { + roundKeys[roundKeyIndex] = new ulong[wordsInBlock]; + } + workingKey = new ulong[wordsInKey]; + if (keyBytes.Length != wordsInKey * BITS_IN_WORD / BITS_IN_BYTE) + { + throw new ArgumentException("Invalid key parameter passed to DSTU7624Engine init"); + } - #region INITIALIZATION - public virtual void Init(bool forEncryption, ICipherParameters parameters) - { - if (parameters is KeyParameter) - { - workingKey = BytesToWords(((KeyParameter)parameters).GetKey()); + /* Unpack encryption key bytes to words */ + Pack.LE_To_UInt64(keyBytes, 0, workingKey); - ulong[] kt = new ulong[nb]; + ulong[] kt = new ulong[wordsInBlock]; KeyExpandKT(workingKey, kt); @@ -158,21 +150,21 @@ namespace Org.BouncyCastle.Crypto.Engines private void KeyExpandKT(ulong[] key, ulong[] kt) { - ulong[] k0 = new ulong[nb]; - ulong[] k1 = new ulong[nb]; + ulong[] k0 = new ulong[wordsInBlock]; + ulong[] k1 = new ulong[wordsInBlock]; - internalState = new ulong[nb]; - internalState[0] += (ulong)(nb + nk + 1); + internalState = new ulong[wordsInBlock]; + internalState[0] += (ulong)(wordsInBlock + wordsInKey + 1); - if (nb == nk) + if (wordsInBlock == wordsInKey) { Array.Copy(key, k0, k0.Length); Array.Copy(key, k1, k1.Length); } else { - Array.Copy(key, 0, k0, 0, nb); - Array.Copy(key, nb, k1, 0, nb); + Array.Copy(key, 0, k0, 0, wordsInBlock); + Array.Copy(key, wordsInBlock, k1, 0, wordsInBlock); } AddRoundKeyExpand(k0); @@ -187,33 +179,34 @@ namespace Org.BouncyCastle.Crypto.Engines EncryptionRound(); - Array.Copy(internalState, kt, nb); + Array.Copy(internalState, kt, wordsInBlock); } + private void KeyExpandEven(ulong[] key, ulong[] kt) { - ulong[] initial_data = new ulong[nk]; + ulong[] initial_data = new ulong[wordsInKey]; - ulong[] kt_round = new ulong[nb]; + ulong[] kt_round = new ulong[wordsInBlock]; - ulong[] tmv = new ulong[nb]; + ulong[] tmv = new ulong[wordsInBlock]; int round = 0; - Array.Copy(key, initial_data, nk); + Array.Copy(key, initial_data, wordsInKey); - for (int i = 0; i < nb; i++) + for (int i = 0; i < wordsInBlock; i++) { tmv[i] = 0x0001000100010001; } while (true) { - Array.Copy(kt, internalState, nb); + Array.Copy(kt, internalState, wordsInBlock); AddRoundKeyExpand(tmv); - Array.Copy(internalState, kt_round, nb); - Array.Copy(initial_data, internalState, nb); + Array.Copy(internalState, kt_round, wordsInBlock); + Array.Copy(initial_data, internalState, wordsInBlock); AddRoundKeyExpand(kt_round); @@ -225,24 +218,24 @@ namespace Org.BouncyCastle.Crypto.Engines AddRoundKeyExpand(kt_round); - Array.Copy(internalState, roundKeys[round], nb); + Array.Copy(internalState, roundKeys[round], wordsInBlock); - if (roundKeysAmount == round) + if (roundsAmount == round) { break; } - if (nk != nb) + if (wordsInKey != wordsInBlock) { round += 2; ShiftLeft(tmv); - Array.Copy(kt, internalState, nb); + Array.Copy(kt, internalState, wordsInBlock); AddRoundKeyExpand(tmv); - Array.Copy(internalState, kt_round, nb); - Array.Copy(initial_data, nb, internalState, 0, nb); + Array.Copy(internalState, kt_round, wordsInBlock); + Array.Copy(initial_data, wordsInBlock, internalState, 0, wordsInBlock); AddRoundKeyExpand(kt_round); @@ -254,9 +247,9 @@ namespace Org.BouncyCastle.Crypto.Engines AddRoundKeyExpand(kt_round); - Array.Copy(internalState, roundKeys[round], nb); + Array.Copy(internalState, roundKeys[round], wordsInBlock); - if (roundKeysAmount == round) + if (roundsAmount == round) { break; } @@ -273,9 +266,9 @@ namespace Org.BouncyCastle.Crypto.Engines } private void KeyExpandOdd() { - for (int i = 1; i < roundKeysAmount; i += 2) + for (int i = 1; i < roundsAmount; i += 2) { - Array.Copy(roundKeys[i - 1], roundKeys[i], nb); + Array.Copy(roundKeys[i - 1], roundKeys[i], wordsInBlock); RotateLeft(roundKeys[i]); } } @@ -311,11 +304,11 @@ namespace Org.BouncyCastle.Crypto.Engines ulong[] plain_ = BytesToWords(plain); - Array.Copy(plain_, internalState, nb); + Array.Copy(plain_, internalState, wordsInBlock); AddRoundKey(round); - for (round = 1; round < roundKeysAmount; round++) + for (round = 1; round < roundsAmount; round++) { EncryptionRound(); @@ -324,11 +317,11 @@ namespace Org.BouncyCastle.Crypto.Engines } EncryptionRound(); - AddRoundKey(roundKeysAmount); + AddRoundKey(roundsAmount); ulong[] cipherText_ = new ulong[internalState.Length]; - Array.Copy(internalState, cipherText_, nb); + Array.Copy(internalState, cipherText_, wordsInBlock); byte[] temp = WordsToBytes(cipherText_); @@ -340,15 +333,15 @@ namespace Org.BouncyCastle.Crypto.Engines Array.Copy(cipherText, inOff, cipherText, 0, blockSizeBits / BITS_IN_BYTE); Array.Resize(ref cipherText, blockSizeBits / BITS_IN_BYTE); - int round = roundKeysAmount; + int round = roundsAmount; ulong[] cipherText_ = BytesToWords(cipherText); - Array.Copy(cipherText_, internalState, nb); + Array.Copy(cipherText_, internalState, wordsInBlock); SubRoundKey(round); - for (round = roundKeysAmount - 1; round > 0; round--) + for (round = roundsAmount - 1; round > 0; round--) { DecryptionRound(); XorRoundKey(round); @@ -359,7 +352,7 @@ namespace Org.BouncyCastle.Crypto.Engines ulong[] decryptedText_ = new ulong[internalState.Length]; - Array.Copy(internalState, decryptedText_, nb); + Array.Copy(internalState, decryptedText_, wordsInBlock); byte[] temp = WordsToBytes(decryptedText_); @@ -378,7 +371,7 @@ namespace Org.BouncyCastle.Crypto.Engines private void AddRoundKeyExpand(ulong[] value) { - for (int i = 0; i < nb; i++) + for (int i = 0; i < wordsInBlock; i++) { internalState[i] += value[i]; } @@ -428,7 +421,7 @@ namespace Org.BouncyCastle.Crypto.Engines private void XorRoundKeyExpand(ulong[] value) { - for (int i = 0; i < nb; i++) + for (int i = 0; i < wordsInBlock; i++) { internalState[i] ^= value[i]; } @@ -436,7 +429,7 @@ namespace Org.BouncyCastle.Crypto.Engines private void XorRoundKey(int round) { - for (int i = 0; i < nb; i++) + for (int i = 0; i < wordsInBlock; i++) { internalState[i] ^= roundKeys[round][i]; } @@ -449,18 +442,18 @@ namespace Org.BouncyCastle.Crypto.Engines byte[] stateBytes = WordsToBytes(internalState); - byte[] nstate = new byte[nb * sizeof(ulong)]; + byte[] nstate = new byte[wordsInBlock * sizeof(ulong)]; for (row = 0; row < sizeof(ulong); row++) { - if (row % (sizeof(ulong) / nb) == 0) + if (row % (sizeof(ulong) / wordsInBlock) == 0) { shift += 1; } - for (col = 0; col < nb; col++) + for (col = 0; col < wordsInBlock; col++) { - nstate[row + ((col + shift) % nb) * sizeof(ulong)] = stateBytes[row + col * sizeof(ulong)]; + nstate[row + ((col + shift) % wordsInBlock) * sizeof(ulong)] = stateBytes[row + col * sizeof(ulong)]; } } @@ -474,18 +467,18 @@ namespace Org.BouncyCastle.Crypto.Engines int shift = -1; byte[] stateBytes = WordsToBytes(internalState); - byte[] nstate = new byte[nb * sizeof(ulong)]; + byte[] nstate = new byte[wordsInBlock * sizeof(ulong)]; for (row = 0; row < sizeof(ulong); row++) { - if (row % (sizeof(ulong) / nb) == 0) + if (row % (sizeof(ulong) / wordsInBlock) == 0) { shift += 1; } - for (col = 0; col < nb; col++) + for (col = 0; col < wordsInBlock; col++) { - nstate[row + col * sizeof(ulong)] = stateBytes[row + ((col + shift) % nb) * sizeof(ulong)]; + nstate[row + col * sizeof(ulong)] = stateBytes[row + ((col + shift) % wordsInBlock) * sizeof(ulong)]; } } @@ -537,7 +530,7 @@ namespace Org.BouncyCastle.Crypto.Engines private void AddRoundKey(int round) { - for (int i = 0; i < nb; ++i) + for (int i = 0; i < wordsInBlock; ++i) { internalState[i] += roundKeys[round][i]; } @@ -545,7 +538,7 @@ namespace Org.BouncyCastle.Crypto.Engines private void SubRoundKey(int round) { - for (int i = 0; i < nb; ++i) + for (int i = 0; i < wordsInBlock; ++i) { internalState[i] -= roundKeys[round][i]; } @@ -568,7 +561,7 @@ namespace Org.BouncyCastle.Crypto.Engines ulong result; byte[] stateBytes = WordsToBytes(internalState); - for (col = 0; col < nb; ++col) + for (col = 0; col < wordsInBlock; ++col) { result = 0; for (row = sizeof(ulong) - 1; row >= 0; --row) @@ -611,7 +604,7 @@ namespace Org.BouncyCastle.Crypto.Engines private void SubBytes() { - for (int i = 0; i < nb; i++) + for (int i = 0; i < wordsInBlock; i++) { internalState[i] = sboxesForEncryption[0][internalState[i] & 0x00000000000000FF] | ((ulong)sboxesForEncryption[1][(internalState[i] & 0x000000000000FF00) >> 8] << 8) | @@ -626,7 +619,7 @@ namespace Org.BouncyCastle.Crypto.Engines private void InvSubBytes() { - for (int i = 0; i < nb; i++) + for (int i = 0; i < wordsInBlock; i++) { internalState[i] = sboxesForDecryption[0][internalState[i] & 0x00000000000000FF] | ((ulong)sboxesForDecryption[1][(internalState[i] & 0x000000000000FF00) >> 8] << 8) | diff --git a/crypto/src/crypto/engines/Dstu7624WrapEngine.cs b/crypto/src/crypto/engines/Dstu7624WrapEngine.cs index bfe8d9c1c..5d21f6e85 100644 --- a/crypto/src/crypto/engines/Dstu7624WrapEngine.cs +++ b/crypto/src/crypto/engines/Dstu7624WrapEngine.cs @@ -21,9 +21,9 @@ namespace Org.BouncyCastle.Crypto.Engines private readonly byte[] checkSumArray, zeroArray; - public Dstu7624WrapEngine(int blockSizeBits, int keySizeBits) + public Dstu7624WrapEngine(int blockSizeBits) { - engine = new Dstu7624Engine(blockSizeBits, keySizeBits); + engine = new Dstu7624Engine(blockSizeBits); param = null; blockSize = blockSizeBits / 8; diff --git a/crypto/src/crypto/macs/DSTU7624Mac.cs b/crypto/src/crypto/macs/DSTU7624Mac.cs index a189e8638..953d8164f 100644 --- a/crypto/src/crypto/macs/DSTU7624Mac.cs +++ b/crypto/src/crypto/macs/DSTU7624Mac.cs @@ -22,9 +22,9 @@ namespace Org.BouncyCastle.Crypto.Macs private byte[] buf; private int bufOff; - public Dstu7624Mac(int blockSizeBits, int keySizeBits, int q) + public Dstu7624Mac(int blockSizeBits, int q) { - engine = new Dstu7624Engine(blockSizeBits, keySizeBits); + engine = new Dstu7624Engine(blockSizeBits); blockSize = blockSizeBits / 8; diff --git a/crypto/src/crypto/util/Pack.cs b/crypto/src/crypto/util/Pack.cs index 96f293d72..ebe5b7af1 100644 --- a/crypto/src/crypto/util/Pack.cs +++ b/crypto/src/crypto/util/Pack.cs @@ -298,5 +298,14 @@ namespace Org.BouncyCastle.Crypto.Utilities uint hi = LE_To_UInt32(bs, off + 4); return ((ulong)hi << 32) | (ulong)lo; } + + internal static void LE_To_UInt64(byte[] bs, int off, ulong[] ns) + { + for (int i = 0; i < ns.Length; ++i) + { + ns[i] = LE_To_UInt64(bs, off); + off += 8; + } + } } } diff --git a/crypto/test/src/crypto/test/DSTU7624Test.cs b/crypto/test/src/crypto/test/DSTU7624Test.cs index baced41fd..67dcd4420 100644 --- a/crypto/test/src/crypto/test/DSTU7624Test.cs +++ b/crypto/test/src/crypto/test/DSTU7624Test.cs @@ -19,7 +19,7 @@ namespace Org.BouncyCastle.Crypto.Tests public class Dstu7624Test : CipherTest { public Dstu7624Test() - : base(tests, new Dstu7624Engine(256, 256), new KeyParameter(new byte[32])) { } + : base(tests, new Dstu7624Engine(256), new KeyParameter(new byte[32])) { } @@ -48,32 +48,32 @@ namespace Org.BouncyCastle.Crypto.Tests new KBlockCipherVectorTest(13, new KCfbBlockCipher(new Dstu7624Engine(512, 512), 512), new ParametersWithIV(new KeyParameter(Hex.Decode("3F3E3D3C3B3A393837363534333231302F2E2D2C2B2A292827262524232221201F1E1D1C1B1A191817161514131211100F0E0D0C0B0A09080706050403020100")), Hex.Decode("7F7E7D7C7B7A797877767574737271706F6E6D6C6B6A696867666564636261605F5E5D5C5B5A595857565554535251504F4E4D4C4B4A49484746454443424140")), "06C061A4A66DFC0910034B3CFBDC4206D8908241C56BF41C4103CFD6DF322210B87F57EAE9F9AD815E606a7D1E8E6BD7CB1EBFBDBCB085C2D06BF3CC1586CB2E88C9155E95B4872D86B49D80F5745B605EAF488AA520A717A92F4D68838E42C995", "EFEEEDECEBEAE9E8E7E6E5E4E3E2E1E0DFDEDDDCDBDAD9D8D7D6D5D4D3D2D1D0CFCECDCCCBCAC9C8C7C6C5C4C3C2C1C0BFBEBDBCBBBAB9B8B7B6B5B4B3B2B1B0AFAEADACABAAA9A8A7A6A5A4A3A2A1A09F9E9D9C9B9A999897969594939291908F"), */ //CBC mode (PADDING NOT SUPPORTED) - new BlockCipherVectorTest(14, new CbcBlockCipher(new Dstu7624Engine(128, 128)), new ParametersWithIV(new KeyParameter(Hex.Decode("000102030405060708090A0B0C0D0E0F")), Hex.Decode("101112131415161718191A1B1C1D1E1F")), "202122232425262728292A2B2C2D2E2F303132333435363738393A3B3C3D3E3F404142434445464748494A4B4C4D4E4F", "A73625D7BE994E85469A9FAABCEDAAB6DBC5F65DD77BB35E06BD7D1D8EAFC8624D6CB31CE189C82B8979F2936DE9BF14"), - new BlockCipherVectorTest(15, new CbcBlockCipher(new Dstu7624Engine(128, 128)), new ParametersWithIV(new KeyParameter(Hex.Decode("0F0E0D0C0B0A09080706050403020100")), Hex.Decode("1F1E1D1C1B1A19181716151413121110")), "88F2F048BA696170E3818915E0DBC0AFA6F141FEBC2F817138DA4AAB2DBF9CE490A488C9C82AC83FB0A6C0EEB64CFD22", "4F4E4D4C4B4A494847464544434241403F3E3D3C3B3A393837363534333231302F2E2D2C2B2A29282726252423222120"), - new BlockCipherVectorTest(16, new CbcBlockCipher(new Dstu7624Engine(128, 256)), new ParametersWithIV(new KeyParameter(Hex.Decode("000102030405060708090A0B0C0D0E0F101112131415161718191A1B1C1D1E1F")), Hex.Decode("202122232425262728292A2B2C2D2E2F")), "303132333435363738393A3B3C3D3E3F404142434445464748494A4B4C4D4E4F505152535455565758595A5B5C5D8000", "13EA15843AD14C50BC03ECEF1F43E398E4217752D3EB046AC393DACC5CA1D6FA0EB9FCEB229362B4F1565527EE3D8433"), - new BlockCipherVectorTest(17, new CbcBlockCipher(new Dstu7624Engine(128, 256)), new ParametersWithIV(new KeyParameter(Hex.Decode("1F1E1D1C1B1A191817161514131211100F0E0D0C0B0A09080706050403020100")), Hex.Decode("2F2E2D2C2B2A29282726252423222120")), "BC8F026FC603ECE05C24FDE87542730999B381870882AC0535D4368C4BABD81B884E96E853EE7E055262D9D204FBE212", "5F5E5D5C5B5A595857565554535251504F4E4D4C4B4A494847464544434241403F3E3D3C3B3A39383736353433323130"), - new BlockCipherVectorTest(18, new CbcBlockCipher(new Dstu7624Engine(256, 256)), new ParametersWithIV(new KeyParameter(Hex.Decode("000102030405060708090A0B0C0D0E0F101112131415161718191A1B1C1D1E1F")), Hex.Decode("202122232425262728292A2B2C2D2E2F303132333435363738393A3B3C3D3E3F")), "404142434445464748494A4B4C4D4E4F505152535455565758595A5B5C5D5E5F606162636465666768696A6B6C6D6E6F707172737475767778797A7B7C7D7E7F808182838485868788898A8B8C8D8E8F909192939495969798999A9B9C9D9E9F", "9CDFDAA75929E7C2A5CFC1BF16B42C5AE3886D0258E8C577DC01DAF62D185FB999B9867736B87110F5F1BC7481912C593F48FF79E2AFDFAB9F704A277EC3E557B1B0A9F223DAE6ED5AF591C4F2D6FB22E48334F5E9B96B1A2EA5200F30A406CE"), - new BlockCipherVectorTest(19, new CbcBlockCipher(new Dstu7624Engine(256, 512)), new ParametersWithIV(new KeyParameter(Hex.Decode("000102030405060708090A0B0C0D0E0F101112131415161718191A1B1C1D1E1F202122232425262728292A2B2C2D2E2F303132333435363738393A3B3C3D3E3F")), Hex.Decode("404142434445464748494A4B4C4D4E4F505152535455565758595A5B5C5D5E5F")), "606162636465666768696A6B6C6D6E6F707172737475767778797A7B7C7D7E7F808182838485868788898A8B8C8D8E8F909192939495969798999A9B9C9D9E9FA0A1A2A3A4A5A6A7A8A9AAABACADAEAFB0B1B2B3B4B5B6B7B8B9BABBBCBDBEBF", "B8A2474578C2FEBF3F94703587BD5FDC3F4A4D2F43575B6144A1E1031FB3D1452B7FD52F5E3411461DAC506869FF8D2FAEF4FEE60379AE00B33AA3EAF911645AF8091CD8A45D141D1FB150E5A01C1F26FF3DBD26AC4225EC7577B2CE57A5B0FF"), - new BlockCipherVectorTest(20, new CbcBlockCipher(new Dstu7624Engine(256, 512)), new ParametersWithIV(new KeyParameter(Hex.Decode("3F3E3D3C3B3A393837363534333231302F2E2D2C2B2A292827262524232221201F1E1D1C1B1A191817161514131211100F0E0D0C0B0A09080706050403020100")), Hex.Decode("5F5E5D5C5B5A595857565554535251504F4E4D4C4B4A49484746454443424140")), "C69A59E10D00F087319B62288A57417C074EAD07C732A87055F0A5AD2BB288105705C45E091A9A6726E9672DC7D8C76FC45C782BCFEF7C39D94DEB84B17035BC8651255A0D34373451B6E1A2C827DB97566C9FF5506C5579F982A0EFC5BA7C28", "BFBEBDBCBBBAB9B8B7B6B5B4B3B2B1B0AFAEADACABAAA9A8A7A6A5A4A3A2A1A09F9E9D9C9B9A999897969594939291908F8E8D8C8B8A898887868584838281807F7E7D7C7B7A797877767574737271706F6E6D6C6B6A69686766656463626160"), - new BlockCipherVectorTest(21, new CbcBlockCipher(new Dstu7624Engine(512, 512)), new ParametersWithIV(new KeyParameter(Hex.Decode("000102030405060708090A0B0C0D0E0F101112131415161718191A1B1C1D1E1F202122232425262728292A2B2C2D2E2F303132333435363738393A3B3C3D3E3F")), Hex.Decode("404142434445464748494A4B4C4D4E4F505152535455565758595A5B5C5D5E5F606162636465666768696A6B6C6D6E6F707172737475767778797A7B7C7D7E7F")), "808182838485868788898A8B8C8D8E8F909192939495969798999A9B9C9D9E9FA0A1A2A3A4A5A6A7A8A9AAABACADAEAFB0B1B2B3B4B5B6B7B8B9BABBBCBDBEBFC0C1C2C3C4C5C6C7C8C9CACBCCCDCECFD0D1D2D3D4D5D6D7D8D9DADBDCDDDEDFE0E1E2E3E4E5E6E7E8E9EAEBECEDEEEFF0F1F2F3F4F5F6F7F8F9FAFBFCFDFEFF", "D4739B829EF901B24C1162AE4FDEF897EDA41FAC7F5770CDC90E1D1CDF124E8D7831E06B4498A4B6F6EC815DF2461DC99BB0449B0F09FCAA2C84090534BCC9329626FD74EF8F0A0BCB5765184629C3CBF53B0FB134F6D0421174B1C4E884D1CD1069A7AD19752DCEBF655842E79B7858BDE01390A760D85E88925BFE38B0FA57"), - new BlockCipherVectorTest(22, new CbcBlockCipher(new Dstu7624Engine(512, 512)), new ParametersWithIV(new KeyParameter(Hex.Decode("3F3E3D3C3B3A393837363534333231302F2E2D2C2B2A292827262524232221201F1E1D1C1B1A191817161514131211100F0E0D0C0B0A09080706050403020100")), Hex.Decode("7F7E7D7C7B7A797877767574737271706F6E6D6C6B6A696867666564636261605F5E5D5C5B5A595857565554535251504F4E4D4C4B4A49484746454443424140")), "5D5B3E3DE5BAA70E0A0684D458856CE759C6018D0B3F087FC1DAC101D380236DD934F2880B02D56A575BCA35A0CE4B0D9BA1F4A39C16CA7D80D59956630F09E54EC91E32B6830FE08323ED393F8028D150BF03CAD0629A5AFEEFF6E44257980618DB2F32B7B2B65B96E8451F1090829D2FFFC615CC1581E9221438DCEAD1FD12", "FFFEFDFCFBFAF9F8F7F6F5F4F3F2F1F0EFEEEDECEBEAE9E8E7E6E5E4E3E2E1E0DFDEDDDCDBDAD9D8D7D6D5D4D3D2D1D0CFCECDCCCBCAC9C8C7C6C5C4C3C2C1C0BFBEBDBCBBBAB9B8B7B6B5B4B3B2B1B0AFAEADACABAAA9A8A7A6A5A4A3A2A1A09F9E9D9C9B9A999897969594939291908F8E8D8C8B8A89888786858483828180"), + new BlockCipherVectorTest(14, new CbcBlockCipher(new Dstu7624Engine(128)), new ParametersWithIV(new KeyParameter(Hex.Decode("000102030405060708090A0B0C0D0E0F")), Hex.Decode("101112131415161718191A1B1C1D1E1F")), "202122232425262728292A2B2C2D2E2F303132333435363738393A3B3C3D3E3F404142434445464748494A4B4C4D4E4F", "A73625D7BE994E85469A9FAABCEDAAB6DBC5F65DD77BB35E06BD7D1D8EAFC8624D6CB31CE189C82B8979F2936DE9BF14"), + new BlockCipherVectorTest(15, new CbcBlockCipher(new Dstu7624Engine(128)), new ParametersWithIV(new KeyParameter(Hex.Decode("0F0E0D0C0B0A09080706050403020100")), Hex.Decode("1F1E1D1C1B1A19181716151413121110")), "88F2F048BA696170E3818915E0DBC0AFA6F141FEBC2F817138DA4AAB2DBF9CE490A488C9C82AC83FB0A6C0EEB64CFD22", "4F4E4D4C4B4A494847464544434241403F3E3D3C3B3A393837363534333231302F2E2D2C2B2A29282726252423222120"), + new BlockCipherVectorTest(16, new CbcBlockCipher(new Dstu7624Engine(128)), new ParametersWithIV(new KeyParameter(Hex.Decode("000102030405060708090A0B0C0D0E0F101112131415161718191A1B1C1D1E1F")), Hex.Decode("202122232425262728292A2B2C2D2E2F")), "303132333435363738393A3B3C3D3E3F404142434445464748494A4B4C4D4E4F505152535455565758595A5B5C5D8000", "13EA15843AD14C50BC03ECEF1F43E398E4217752D3EB046AC393DACC5CA1D6FA0EB9FCEB229362B4F1565527EE3D8433"), + new BlockCipherVectorTest(17, new CbcBlockCipher(new Dstu7624Engine(128)), new ParametersWithIV(new KeyParameter(Hex.Decode("1F1E1D1C1B1A191817161514131211100F0E0D0C0B0A09080706050403020100")), Hex.Decode("2F2E2D2C2B2A29282726252423222120")), "BC8F026FC603ECE05C24FDE87542730999B381870882AC0535D4368C4BABD81B884E96E853EE7E055262D9D204FBE212", "5F5E5D5C5B5A595857565554535251504F4E4D4C4B4A494847464544434241403F3E3D3C3B3A39383736353433323130"), + new BlockCipherVectorTest(18, new CbcBlockCipher(new Dstu7624Engine(256)), new ParametersWithIV(new KeyParameter(Hex.Decode("000102030405060708090A0B0C0D0E0F101112131415161718191A1B1C1D1E1F")), Hex.Decode("202122232425262728292A2B2C2D2E2F303132333435363738393A3B3C3D3E3F")), "404142434445464748494A4B4C4D4E4F505152535455565758595A5B5C5D5E5F606162636465666768696A6B6C6D6E6F707172737475767778797A7B7C7D7E7F808182838485868788898A8B8C8D8E8F909192939495969798999A9B9C9D9E9F", "9CDFDAA75929E7C2A5CFC1BF16B42C5AE3886D0258E8C577DC01DAF62D185FB999B9867736B87110F5F1BC7481912C593F48FF79E2AFDFAB9F704A277EC3E557B1B0A9F223DAE6ED5AF591C4F2D6FB22E48334F5E9B96B1A2EA5200F30A406CE"), + new BlockCipherVectorTest(19, new CbcBlockCipher(new Dstu7624Engine(256)), new ParametersWithIV(new KeyParameter(Hex.Decode("000102030405060708090A0B0C0D0E0F101112131415161718191A1B1C1D1E1F202122232425262728292A2B2C2D2E2F303132333435363738393A3B3C3D3E3F")), Hex.Decode("404142434445464748494A4B4C4D4E4F505152535455565758595A5B5C5D5E5F")), "606162636465666768696A6B6C6D6E6F707172737475767778797A7B7C7D7E7F808182838485868788898A8B8C8D8E8F909192939495969798999A9B9C9D9E9FA0A1A2A3A4A5A6A7A8A9AAABACADAEAFB0B1B2B3B4B5B6B7B8B9BABBBCBDBEBF", "B8A2474578C2FEBF3F94703587BD5FDC3F4A4D2F43575B6144A1E1031FB3D1452B7FD52F5E3411461DAC506869FF8D2FAEF4FEE60379AE00B33AA3EAF911645AF8091CD8A45D141D1FB150E5A01C1F26FF3DBD26AC4225EC7577B2CE57A5B0FF"), + new BlockCipherVectorTest(20, new CbcBlockCipher(new Dstu7624Engine(256)), new ParametersWithIV(new KeyParameter(Hex.Decode("3F3E3D3C3B3A393837363534333231302F2E2D2C2B2A292827262524232221201F1E1D1C1B1A191817161514131211100F0E0D0C0B0A09080706050403020100")), Hex.Decode("5F5E5D5C5B5A595857565554535251504F4E4D4C4B4A49484746454443424140")), "C69A59E10D00F087319B62288A57417C074EAD07C732A87055F0A5AD2BB288105705C45E091A9A6726E9672DC7D8C76FC45C782BCFEF7C39D94DEB84B17035BC8651255A0D34373451B6E1A2C827DB97566C9FF5506C5579F982A0EFC5BA7C28", "BFBEBDBCBBBAB9B8B7B6B5B4B3B2B1B0AFAEADACABAAA9A8A7A6A5A4A3A2A1A09F9E9D9C9B9A999897969594939291908F8E8D8C8B8A898887868584838281807F7E7D7C7B7A797877767574737271706F6E6D6C6B6A69686766656463626160"), + new BlockCipherVectorTest(21, new CbcBlockCipher(new Dstu7624Engine(512)), new ParametersWithIV(new KeyParameter(Hex.Decode("000102030405060708090A0B0C0D0E0F101112131415161718191A1B1C1D1E1F202122232425262728292A2B2C2D2E2F303132333435363738393A3B3C3D3E3F")), Hex.Decode("404142434445464748494A4B4C4D4E4F505152535455565758595A5B5C5D5E5F606162636465666768696A6B6C6D6E6F707172737475767778797A7B7C7D7E7F")), "808182838485868788898A8B8C8D8E8F909192939495969798999A9B9C9D9E9FA0A1A2A3A4A5A6A7A8A9AAABACADAEAFB0B1B2B3B4B5B6B7B8B9BABBBCBDBEBFC0C1C2C3C4C5C6C7C8C9CACBCCCDCECFD0D1D2D3D4D5D6D7D8D9DADBDCDDDEDFE0E1E2E3E4E5E6E7E8E9EAEBECEDEEEFF0F1F2F3F4F5F6F7F8F9FAFBFCFDFEFF", "D4739B829EF901B24C1162AE4FDEF897EDA41FAC7F5770CDC90E1D1CDF124E8D7831E06B4498A4B6F6EC815DF2461DC99BB0449B0F09FCAA2C84090534BCC9329626FD74EF8F0A0BCB5765184629C3CBF53B0FB134F6D0421174B1C4E884D1CD1069A7AD19752DCEBF655842E79B7858BDE01390A760D85E88925BFE38B0FA57"), + new BlockCipherVectorTest(22, new CbcBlockCipher(new Dstu7624Engine(512)), new ParametersWithIV(new KeyParameter(Hex.Decode("3F3E3D3C3B3A393837363534333231302F2E2D2C2B2A292827262524232221201F1E1D1C1B1A191817161514131211100F0E0D0C0B0A09080706050403020100")), Hex.Decode("7F7E7D7C7B7A797877767574737271706F6E6D6C6B6A696867666564636261605F5E5D5C5B5A595857565554535251504F4E4D4C4B4A49484746454443424140")), "5D5B3E3DE5BAA70E0A0684D458856CE759C6018D0B3F087FC1DAC101D380236DD934F2880B02D56A575BCA35A0CE4B0D9BA1F4A39C16CA7D80D59956630F09E54EC91E32B6830FE08323ED393F8028D150BF03CAD0629A5AFEEFF6E44257980618DB2F32B7B2B65B96E8451F1090829D2FFFC615CC1581E9221438DCEAD1FD12", "FFFEFDFCFBFAF9F8F7F6F5F4F3F2F1F0EFEEEDECEBEAE9E8E7E6E5E4E3E2E1E0DFDEDDDCDBDAD9D8D7D6D5D4D3D2D1D0CFCECDCCCBCAC9C8C7C6C5C4C3C2C1C0BFBEBDBCBBBAB9B8B7B6B5B4B3B2B1B0AFAEADACABAAA9A8A7A6A5A4A3A2A1A09F9E9D9C9B9A999897969594939291908F8E8D8C8B8A89888786858483828180"), //OFB mode - new BlockCipherVectorTest(23, new OfbBlockCipher(new Dstu7624Engine(128, 128), 128), new ParametersWithIV(new KeyParameter(Hex.Decode("000102030405060708090A0B0C0D0E0F")), Hex.Decode("101112131415161718191A1B1C1D1E1F")), "202122232425262728292A2B2C2D2E2F303132333435363738393A3B3C3D3E3F404142434445464748494A4B4C4D4E4F", "A19E3E5E53BE8A07C9E0C01298FF832953205C661BD85A51F3A94113BC785CAB634B36E89A8FDD16A12E4467F5CC5A26"), - new BlockCipherVectorTest(24, new OfbBlockCipher(new Dstu7624Engine(128, 128), 128), new ParametersWithIV(new KeyParameter(Hex.Decode("0F0E0D0C0B0A09080706050403020100")), Hex.Decode("1F1E1D1C1B1A19181716151413121110")), "649A1EAAE160AF20F5B3EF2F58D66C1178B82E00D26F30689C8EC22E8E86E9CBB0BD4FFEE39EB13C2311276A906DD636", "4F4E4D4C4B4A494847464544434241403F3E3D3C3B3A393837363534333231302F2E2D2C2B2A29282726252423222120"), - new BlockCipherVectorTest(25, new OfbBlockCipher(new Dstu7624Engine(128, 256), 128), new ParametersWithIV(new KeyParameter(Hex.Decode("1F1E1D1C1B1A191817161514131211100F0E0D0C0B0A09080706050403020100")), Hex.Decode("2F2E2D2C2B2A29282726252423222120")), "1A66CFBFEC00C6D52E39923E858DD64B214AB787798D3D5059A6B498AD66B34EAC48C4074BEC0D98C6", "5F5E5D5C5B5A595857565554535251504F4E4D4C4B4A494847464544434241403F3E3D3C3B3A393837"), - new BlockCipherVectorTest(26, new OfbBlockCipher(new Dstu7624Engine(256, 256), 256), new ParametersWithIV(new KeyParameter(Hex.Decode("000102030405060708090A0B0C0D0E0F101112131415161718191A1B1C1D1E1F")), Hex.Decode("202122232425262728292A2B2C2D2E2F303132333435363738393A3B3C3D3E3F")), "404142434445464748494A4B4C4D4E4F505152535455565758595A5B5C5D5E5F606162636465666768696A6B6C6D6E6F707172737475767778797A7B7C7D7E7F808182838485868788898A8B8C8D8E8F90", "B62F7F144A8C6772E693A96890F064C3F06831BF743F5B0DD061067F3D22877331AA6A99D939F05B7550E9402BD1615CC7B2D4A167E83EC0D8A894F92C72E176F3880B61C311D69CE1210C59184E818E19"), - new BlockCipherVectorTest(27, new OfbBlockCipher(new Dstu7624Engine(256, 256), 256), new ParametersWithIV(new KeyParameter(Hex.Decode("1F1E1D1C1B1A191817161514131211100F0E0D0C0B0A09080706050403020100")), Hex.Decode("3F3E3D3C3B3A393837363534333231302F2E2D2C2B2A29282726252423222120")), "7758A939DD6BD00CAF9153E5A5D5A66129105CA1EA54A97C06FA4A40960A068F55E34F9339A14436216948F92FA2FB5286D3AB1E81543FC0018A0C4E8C493475F4D35DCFB0A7A5377F6669B857CDC978E4", "9F9E9D9C9B9A999897969594939291908F8E8D8C8B8A898887868584838281807F7E7D7C7B7A797877767574737271706F6E6D6C6B6A696867666564636261605F5E5D5C5B5A595857565554535251504F"), - new BlockCipherVectorTest(28, new OfbBlockCipher(new Dstu7624Engine(256, 512), 256), new ParametersWithIV(new KeyParameter(Hex.Decode("000102030405060708090A0B0C0D0E0F101112131415161718191A1B1C1D1E1F202122232425262728292A2B2C2D2E2F303132333435363738393A3B3C3D3E3F")), Hex.Decode("404142434445464748494A4B4C4D4E4F505152535455565758595A5B5C5D5E5F")), "606162636465666768696A6B6C6D6E6F707172737475767778797A7B7C7D7E7F808182838485868788898A8B8C8D8E8F909192939495969798999A9B9C9D9E9FA0A1A2A3A4A5A6A7A8A9AAABACADAEAFB0", "0008F28A82D2D01D23BFB2F8BB4F06D8FE73BA4F48A2977585570ED3818323A668883C9DCFF610CC7E3EA5C025FBBC5CA6520F8F11CA35CEB9B07031E6DBFABE39001E9A3CC0A24BBC565939592B4DEDBD"), - new BlockCipherVectorTest(29, new OfbBlockCipher(new Dstu7624Engine(256, 512), 256), new ParametersWithIV(new KeyParameter(Hex.Decode("3F3E3D3C3B3A393837363534333231302F2E2D2C2B2A292827262524232221201F1E1D1C1B1A191817161514131211100F0E0D0C0B0A09080706050403020100")), Hex.Decode("5F5E5D5C5B5A595857565554535251504F4E4D4C4B4A49484746454443424140")), "98E122708FDABB1B1A5765C396DC79D7573221EC486ADDABD1770B147A6DD00B5FBC4F1EC68C59775B7AAA4D43C4CCE4F396D982DF64D30B03EF6C3B997BA0ED940BBC590BD30D64B5AE207147D71086B5", "BFBEBDBCBBBAB9B8B7B6B5B4B3B2B1B0AFAEADACABAAA9A8A7A6A5A4A3A2A1A09F9E9D9C9B9A999897969594939291908F8E8D8C8B8A898887868584838281807F7E7D7C7B7A797877767574737271706F"), - new BlockCipherVectorTest(30, new OfbBlockCipher(new Dstu7624Engine(512, 512), 512), new ParametersWithIV(new KeyParameter(Hex.Decode("000102030405060708090A0B0C0D0E0F101112131415161718191A1B1C1D1E1F202122232425262728292A2B2C2D2E2F303132333435363738393A3B3C3D3E3F")), Hex.Decode("404142434445464748494A4B4C4D4E4F505152535455565758595A5B5C5D5E5F606162636465666768696A6B6C6D6E6F707172737475767778797A7B7C7D7E7F")), "808182838485868788898A8B8C8D8E8F909192939495969798999A9B9C9D9E9FA0A1A2A3A4A5A6A7A8A9AAABACADAEAFB0B1B2B3B4B5B6B7B8B9BABBBCBDBEBFC0C1C2C3C4C5C6C7C8C9CACBCCCDCECFD0D1D2D3D4D5D6D7D8D9DADBDCDDDEDFE0", "CAA761980599B3ED2E945C41891BAD95F72B11C73ED26536A6847458BC76C827357156B4B3FE0DC1877F5B9F17B866C37B21D89531DB48007D05DEC928B06766C014BB9080385EDF0677E48A0A39B5E7489E28E82FFFD1F84694F17296CB701656"), - new BlockCipherVectorTest(31, new OfbBlockCipher(new Dstu7624Engine(512, 512), 512), new ParametersWithIV(new KeyParameter(Hex.Decode("3F3E3D3C3B3A393837363534333231302F2E2D2C2B2A292827262524232221201F1E1D1C1B1A191817161514131211100F0E0D0C0B0A09080706050403020100")), Hex.Decode("7F7E7D7C7B7A797877767574737271706F6E6D6C6B6A696867666564636261605F5E5D5C5B5A595857565554535251504F4E4D4C4B4A49484746454443424140")), "06C061A4A66DFC0910034B3CFBDC4206D8908241C56BF41C4103CFD6DF322210B87F57EAE9F9AD815E606A7D1E8E6BD7CB1EBFBDBCB085C2D06BF3CC1586CB2EE1D81D38437F425131321647E42F5DE309D33F25B89DE37124683E4B44824FC56D", "EFEEEDECEBEAE9E8E7E6E5E4E3E2E1E0DFDEDDDCDBDAD9D8D7D6D5D4D3D2D1D0CFCECDCCCBCAC9C8C7C6C5C4C3C2C1C0BFBEBDBCBBBAB9B8B7B6B5B4B3B2B1B0AFAEADACABAAA9A8A7A6A5A4A3A2A1A09F9E9D9C9B9A999897969594939291908F"), + new BlockCipherVectorTest(23, new OfbBlockCipher(new Dstu7624Engine(128), 128), new ParametersWithIV(new KeyParameter(Hex.Decode("000102030405060708090A0B0C0D0E0F")), Hex.Decode("101112131415161718191A1B1C1D1E1F")), "202122232425262728292A2B2C2D2E2F303132333435363738393A3B3C3D3E3F404142434445464748494A4B4C4D4E4F", "A19E3E5E53BE8A07C9E0C01298FF832953205C661BD85A51F3A94113BC785CAB634B36E89A8FDD16A12E4467F5CC5A26"), + new BlockCipherVectorTest(24, new OfbBlockCipher(new Dstu7624Engine(128), 128), new ParametersWithIV(new KeyParameter(Hex.Decode("0F0E0D0C0B0A09080706050403020100")), Hex.Decode("1F1E1D1C1B1A19181716151413121110")), "649A1EAAE160AF20F5B3EF2F58D66C1178B82E00D26F30689C8EC22E8E86E9CBB0BD4FFEE39EB13C2311276A906DD636", "4F4E4D4C4B4A494847464544434241403F3E3D3C3B3A393837363534333231302F2E2D2C2B2A29282726252423222120"), + new BlockCipherVectorTest(25, new OfbBlockCipher(new Dstu7624Engine(128), 128), new ParametersWithIV(new KeyParameter(Hex.Decode("1F1E1D1C1B1A191817161514131211100F0E0D0C0B0A09080706050403020100")), Hex.Decode("2F2E2D2C2B2A29282726252423222120")), "1A66CFBFEC00C6D52E39923E858DD64B214AB787798D3D5059A6B498AD66B34EAC48C4074BEC0D98C6", "5F5E5D5C5B5A595857565554535251504F4E4D4C4B4A494847464544434241403F3E3D3C3B3A393837"), + new BlockCipherVectorTest(26, new OfbBlockCipher(new Dstu7624Engine(256), 256), new ParametersWithIV(new KeyParameter(Hex.Decode("000102030405060708090A0B0C0D0E0F101112131415161718191A1B1C1D1E1F")), Hex.Decode("202122232425262728292A2B2C2D2E2F303132333435363738393A3B3C3D3E3F")), "404142434445464748494A4B4C4D4E4F505152535455565758595A5B5C5D5E5F606162636465666768696A6B6C6D6E6F707172737475767778797A7B7C7D7E7F808182838485868788898A8B8C8D8E8F90", "B62F7F144A8C6772E693A96890F064C3F06831BF743F5B0DD061067F3D22877331AA6A99D939F05B7550E9402BD1615CC7B2D4A167E83EC0D8A894F92C72E176F3880B61C311D69CE1210C59184E818E19"), + new BlockCipherVectorTest(27, new OfbBlockCipher(new Dstu7624Engine(256), 256), new ParametersWithIV(new KeyParameter(Hex.Decode("1F1E1D1C1B1A191817161514131211100F0E0D0C0B0A09080706050403020100")), Hex.Decode("3F3E3D3C3B3A393837363534333231302F2E2D2C2B2A29282726252423222120")), "7758A939DD6BD00CAF9153E5A5D5A66129105CA1EA54A97C06FA4A40960A068F55E34F9339A14436216948F92FA2FB5286D3AB1E81543FC0018A0C4E8C493475F4D35DCFB0A7A5377F6669B857CDC978E4", "9F9E9D9C9B9A999897969594939291908F8E8D8C8B8A898887868584838281807F7E7D7C7B7A797877767574737271706F6E6D6C6B6A696867666564636261605F5E5D5C5B5A595857565554535251504F"), + new BlockCipherVectorTest(28, new OfbBlockCipher(new Dstu7624Engine(256), 256), new ParametersWithIV(new KeyParameter(Hex.Decode("000102030405060708090A0B0C0D0E0F101112131415161718191A1B1C1D1E1F202122232425262728292A2B2C2D2E2F303132333435363738393A3B3C3D3E3F")), Hex.Decode("404142434445464748494A4B4C4D4E4F505152535455565758595A5B5C5D5E5F")), "606162636465666768696A6B6C6D6E6F707172737475767778797A7B7C7D7E7F808182838485868788898A8B8C8D8E8F909192939495969798999A9B9C9D9E9FA0A1A2A3A4A5A6A7A8A9AAABACADAEAFB0", "0008F28A82D2D01D23BFB2F8BB4F06D8FE73BA4F48A2977585570ED3818323A668883C9DCFF610CC7E3EA5C025FBBC5CA6520F8F11CA35CEB9B07031E6DBFABE39001E9A3CC0A24BBC565939592B4DEDBD"), + new BlockCipherVectorTest(29, new OfbBlockCipher(new Dstu7624Engine(256), 256), new ParametersWithIV(new KeyParameter(Hex.Decode("3F3E3D3C3B3A393837363534333231302F2E2D2C2B2A292827262524232221201F1E1D1C1B1A191817161514131211100F0E0D0C0B0A09080706050403020100")), Hex.Decode("5F5E5D5C5B5A595857565554535251504F4E4D4C4B4A49484746454443424140")), "98E122708FDABB1B1A5765C396DC79D7573221EC486ADDABD1770B147A6DD00B5FBC4F1EC68C59775B7AAA4D43C4CCE4F396D982DF64D30B03EF6C3B997BA0ED940BBC590BD30D64B5AE207147D71086B5", "BFBEBDBCBBBAB9B8B7B6B5B4B3B2B1B0AFAEADACABAAA9A8A7A6A5A4A3A2A1A09F9E9D9C9B9A999897969594939291908F8E8D8C8B8A898887868584838281807F7E7D7C7B7A797877767574737271706F"), + new BlockCipherVectorTest(30, new OfbBlockCipher(new Dstu7624Engine(512), 512), new ParametersWithIV(new KeyParameter(Hex.Decode("000102030405060708090A0B0C0D0E0F101112131415161718191A1B1C1D1E1F202122232425262728292A2B2C2D2E2F303132333435363738393A3B3C3D3E3F")), Hex.Decode("404142434445464748494A4B4C4D4E4F505152535455565758595A5B5C5D5E5F606162636465666768696A6B6C6D6E6F707172737475767778797A7B7C7D7E7F")), "808182838485868788898A8B8C8D8E8F909192939495969798999A9B9C9D9E9FA0A1A2A3A4A5A6A7A8A9AAABACADAEAFB0B1B2B3B4B5B6B7B8B9BABBBCBDBEBFC0C1C2C3C4C5C6C7C8C9CACBCCCDCECFD0D1D2D3D4D5D6D7D8D9DADBDCDDDEDFE0", "CAA761980599B3ED2E945C41891BAD95F72B11C73ED26536A6847458BC76C827357156B4B3FE0DC1877F5B9F17B866C37B21D89531DB48007D05DEC928B06766C014BB9080385EDF0677E48A0A39B5E7489E28E82FFFD1F84694F17296CB701656"), + new BlockCipherVectorTest(31, new OfbBlockCipher(new Dstu7624Engine(512), 512), new ParametersWithIV(new KeyParameter(Hex.Decode("3F3E3D3C3B3A393837363534333231302F2E2D2C2B2A292827262524232221201F1E1D1C1B1A191817161514131211100F0E0D0C0B0A09080706050403020100")), Hex.Decode("7F7E7D7C7B7A797877767574737271706F6E6D6C6B6A696867666564636261605F5E5D5C5B5A595857565554535251504F4E4D4C4B4A49484746454443424140")), "06C061A4A66DFC0910034B3CFBDC4206D8908241C56BF41C4103CFD6DF322210B87F57EAE9F9AD815E606A7D1E8E6BD7CB1EBFBDBCB085C2D06BF3CC1586CB2EE1D81D38437F425131321647E42F5DE309D33F25B89DE37124683E4B44824FC56D", "EFEEEDECEBEAE9E8E7E6E5E4E3E2E1E0DFDEDDDCDBDAD9D8D7D6D5D4D3D2D1D0CFCECDCCCBCAC9C8C7C6C5C4C3C2C1C0BFBEBDBCBBBAB9B8B7B6B5B4B3B2B1B0AFAEADACABAAA9A8A7A6A5A4A3A2A1A09F9E9D9C9B9A999897969594939291908F"), //CTR mode - new BlockCipherVectorTest(24, new KCtrBlockCipher(new Dstu7624Engine(128, 128)), new ParametersWithIV(new KeyParameter(Hex.Decode("000102030405060708090A0B0C0D0E0F")), Hex.Decode("101112131415161718191A1B1C1D1E1F")), "202122232425262728292A2B2C2D2E2F303132333435363738393A3B3C3D3E3F404142434445464748", "A90A6B9780ABDFDFF64D14F5439E88F266DC50EDD341528DD5E698E2F000CE21F872DAF9FE1811844A"), - new BlockCipherVectorTest(25, new KCtrBlockCipher(new Dstu7624Engine(128, 128)), new ParametersWithIV(new KeyParameter(Hex.Decode("000102030405060708090A0B0C0D0E0F")), Hex.Decode("101112131415161718191A1B1C1D1E1F")), "303132333435363738393A3B3C3D3E3F404142434445464748494A4B4C4D4E4F", "B91A7B8790BBCFCFE65D04E5538E98E216AC209DA33122FDA596E8928070BE51"), - new StreamCipherVectorTest(26, new KCtrBlockCipher(new Dstu7624Engine(128, 128)), new ParametersWithIV(new KeyParameter(Hex.Decode("000102030405060708090A0B0C0D0E0F")), Hex.Decode("101112131415161718191A1B1C1D1E1F")), "202122232425262728292A2B2C2D2E2F303132333435363738393A3B3C3D3E3F404142434445464748", "A90A6B9780ABDFDFF64D14F5439E88F266DC50EDD341528DD5E698E2F000CE21F872DAF9FE1811844A"), - new StreamCipherVectorTest(27, new KCtrBlockCipher(new Dstu7624Engine(128, 128)), new ParametersWithIV(new KeyParameter(Hex.Decode("000102030405060708090A0B0C0D0E0F")), Hex.Decode("101112131415161718191A1B1C1D1E1F")), "303132333435363738393A3B3C3D3E3F404142434445464748494A4B4C4D4E4F", "B91A7B8790BBCFCFE65D04E5538E98E216AC209DA33122FDA596E8928070BE51") + new BlockCipherVectorTest(24, new KCtrBlockCipher(new Dstu7624Engine(128)), new ParametersWithIV(new KeyParameter(Hex.Decode("000102030405060708090A0B0C0D0E0F")), Hex.Decode("101112131415161718191A1B1C1D1E1F")), "202122232425262728292A2B2C2D2E2F303132333435363738393A3B3C3D3E3F404142434445464748", "A90A6B9780ABDFDFF64D14F5439E88F266DC50EDD341528DD5E698E2F000CE21F872DAF9FE1811844A"), + new BlockCipherVectorTest(25, new KCtrBlockCipher(new Dstu7624Engine(128)), new ParametersWithIV(new KeyParameter(Hex.Decode("000102030405060708090A0B0C0D0E0F")), Hex.Decode("101112131415161718191A1B1C1D1E1F")), "303132333435363738393A3B3C3D3E3F404142434445464748494A4B4C4D4E4F", "B91A7B8790BBCFCFE65D04E5538E98E216AC209DA33122FDA596E8928070BE51"), + new StreamCipherVectorTest(26, new KCtrBlockCipher(new Dstu7624Engine(128)), new ParametersWithIV(new KeyParameter(Hex.Decode("000102030405060708090A0B0C0D0E0F")), Hex.Decode("101112131415161718191A1B1C1D1E1F")), "202122232425262728292A2B2C2D2E2F303132333435363738393A3B3C3D3E3F404142434445464748", "A90A6B9780ABDFDFF64D14F5439E88F266DC50EDD341528DD5E698E2F000CE21F872DAF9FE1811844A"), + new StreamCipherVectorTest(27, new KCtrBlockCipher(new Dstu7624Engine(128)), new ParametersWithIV(new KeyParameter(Hex.Decode("000102030405060708090A0B0C0D0E0F")), Hex.Decode("101112131415161718191A1B1C1D1E1F")), "303132333435363738393A3B3C3D3E3F404142434445464748494A4B4C4D4E4F", "B91A7B8790BBCFCFE65D04E5538E98E216AC209DA33122FDA596E8928070BE51") }; public override ITestResult Perform() @@ -110,7 +110,7 @@ namespace Org.BouncyCastle.Crypto.Tests byte[] mac = new byte[128 / 8]; - Dstu7624Mac dstu7624Mac = new Dstu7624Mac(128, 128, 128); + Dstu7624Mac dstu7624Mac = new Dstu7624Mac(128, 128); dstu7624Mac.Init(new KeyParameter(key)); dstu7624Mac.BlockUpdate(authtext, 0, authtext.Length); dstu7624Mac.DoFinal(mac, 0); @@ -140,7 +140,7 @@ namespace Org.BouncyCastle.Crypto.Tests expectedMac = Hex.Decode("7279FA6BC8EF7525B2B35260D00A1743"); - dstu7624Mac = new Dstu7624Mac(512, 512, 128); + dstu7624Mac = new Dstu7624Mac(512, 128); dstu7624Mac.Init(new KeyParameter(key)); dstu7624Mac.BlockUpdate(authtext, 0, authtext.Length); dstu7624Mac.DoFinal(mac, 0); @@ -164,7 +164,7 @@ namespace Org.BouncyCastle.Crypto.Tests byte[] output = new byte[expectedWrappedText.Length]; - Dstu7624WrapEngine wrapper = new Dstu7624WrapEngine(128, 128); + Dstu7624WrapEngine wrapper = new Dstu7624WrapEngine(128); wrapper.Init(true, new KeyParameter(key)); output = wrapper.Wrap(textToWrap, 0, textToWrap.Length); @@ -224,7 +224,7 @@ namespace Org.BouncyCastle.Crypto.Tests output = new byte[expectedWrappedText.Length]; - wrapper = new Dstu7624WrapEngine(128, 256); + wrapper = new Dstu7624WrapEngine(128); wrapper.Init(true, new KeyParameter(key)); output = wrapper.Wrap(textToWrap, 0, textToWrap.Length); @@ -253,7 +253,7 @@ namespace Org.BouncyCastle.Crypto.Tests output = new byte[expectedWrappedText.Length]; - wrapper = new Dstu7624WrapEngine(128, 256); + wrapper = new Dstu7624WrapEngine(128); wrapper.Init(true, new KeyParameter(key)); output = wrapper.Wrap(textToWrap, 0, textToWrap.Length); @@ -282,7 +282,7 @@ namespace Org.BouncyCastle.Crypto.Tests output = new byte[expectedWrappedText.Length]; - wrapper = new Dstu7624WrapEngine(256, 256); + wrapper = new Dstu7624WrapEngine(256); wrapper.Init(true, new KeyParameter(key)); output = wrapper.Wrap(textToWrap, 0, textToWrap.Length); @@ -312,7 +312,7 @@ namespace Org.BouncyCastle.Crypto.Tests output = new byte[expectedWrappedText.Length]; - wrapper = new Dstu7624WrapEngine(256, 256); + wrapper = new Dstu7624WrapEngine(256); wrapper.Init(true, new KeyParameter(key)); output = wrapper.Wrap(textToWrap, 0, textToWrap.Length); @@ -342,7 +342,7 @@ namespace Org.BouncyCastle.Crypto.Tests output = new byte[expectedWrappedText.Length]; - wrapper = new Dstu7624WrapEngine(256, 512); + wrapper = new Dstu7624WrapEngine(256); wrapper.Init(true, new KeyParameter(key)); output = wrapper.Wrap(textToWrap, 0, textToWrap.Length); @@ -371,7 +371,7 @@ namespace Org.BouncyCastle.Crypto.Tests output = new byte[expectedWrappedText.Length]; - wrapper = new Dstu7624WrapEngine(256, 512); + wrapper = new Dstu7624WrapEngine(256); wrapper.Init(true, new KeyParameter(key)); output = wrapper.Wrap(textToWrap, 0, textToWrap.Length); @@ -400,7 +400,7 @@ namespace Org.BouncyCastle.Crypto.Tests output = new byte[expectedWrappedText.Length]; - wrapper = new Dstu7624WrapEngine(512, 512); + wrapper = new Dstu7624WrapEngine(512); wrapper.Init(true, new KeyParameter(key)); output = wrapper.Wrap(textToWrap, 0, textToWrap.Length); @@ -430,7 +430,7 @@ namespace Org.BouncyCastle.Crypto.Tests output = new byte[expectedWrappedText.Length]; - wrapper = new Dstu7624WrapEngine(512, 512); + wrapper = new Dstu7624WrapEngine(512); wrapper.Init(true, new KeyParameter(key)); output = wrapper.Wrap(textToWrap, 0, textToWrap.Length); |