示例#1
0
        public ThreefishEngine(int blocksizeBits)
        {
            //IL_00b8: Unknown result type (might be due to invalid IL or missing references)
            blocksizeBytes = blocksizeBits / 8;
            blocksizeWords = blocksizeBytes / 8;
            currentBlock   = new ulong[blocksizeWords];
            kw             = new ulong[2 * blocksizeWords + 1];
            switch (blocksizeBits)
            {
            case 256:
                cipher = new Threefish256Cipher(kw, t);
                break;

            case 512:
                cipher = new Threefish512Cipher(kw, t);
                break;

            case 1024:
                cipher = new Threefish1024Cipher(kw, t);
                break;

            default:
                throw new ArgumentException("Invalid blocksize - Threefish is defined with block size of 256, 512, or 1024 bits");
            }
        }
示例#2
0
		/// <summary>
		/// Constructs a new Threefish cipher, with a specified block size.
		/// </summary>
		/// <param name="blocksizeBits">the block size in bits, one of <see cref="BLOCKSIZE_256"/>, <see cref="BLOCKSIZE_512"/>,
		///                      <see cref="BLOCKSIZE_1024"/> .</param>
		public ThreefishEngine(int blocksizeBits)
		{
			this.blocksizeBytes = (blocksizeBits / 8);
			this.blocksizeWords = (this.blocksizeBytes / 8);
			this.currentBlock = new ulong[blocksizeWords];

			/*
	         * Provide room for original key words, extended key word and repeat of key words for modulo
	         * free lookup of key schedule words.
	         */
			this.kw = new ulong[2 * blocksizeWords + 1];

			switch (blocksizeBits)
			{
				case BLOCKSIZE_256:
				cipher = new Threefish256Cipher(kw, t);
				break;
				case BLOCKSIZE_512:
				cipher = new Threefish512Cipher(kw, t);
				break;
				case BLOCKSIZE_1024:
				cipher = new Threefish1024Cipher(kw, t);
				break;
				default:
				throw new ArgumentException(
					"Invalid blocksize - Threefish is defined with block size of 256, 512, or 1024 bits");
			}
		}