Example #1
0
        /// <remarks>
        /// Default generation function
        /// </remarks>
        private void GenerateConfiguration()
        {
            Threefish256 cipher = new Threefish256();
            UbiTweak     tweak  = new UbiTweak();

            // initialize the tweak value
            tweak.StartNewBlockType(UbiType.Config);
            tweak.IsFinalBlock  = true;
            tweak.BitsProcessed = 32;

            cipher.SetTweak(tweak.Tweak);
            cipher.Encrypt(m_configString, m_configValue);

            m_configValue[0] ^= m_configString[0];
            m_configValue[1] ^= m_configString[1];
            m_configValue[2] ^= m_configString[2];
        }
Example #2
0
        private void ProcessBlock(int bytes)
        {
            // set the key to the current state
            m_blockCipher.SetKey(m_digestState);

            // update tweak
            m_ubiParameters.BitsProcessed += (long)bytes;
            m_blockCipher.SetTweak(m_ubiParameters.Tweak);

            // encrypt block
            m_blockCipher.Encrypt(m_cipherInput, m_digestState);

            // feed-forward input with state
            for (int i = 0; i < m_cipherInput.Length; i++)
            {
                m_digestState[i] ^= m_cipherInput[i];
            }
        }
Example #3
0
        private void ProcessBlock(int bytes)
        {
            // Set the key to the current state
            _blockCipher.SetKey(_digestState);

            // Update tweak
            UbiParameters.BitsProcessed += (Int64)bytes;
            _blockCipher.SetTweak(UbiParameters.Tweak);

            // Encrypt block
            _blockCipher.Encrypt(_cipherInput, _digestState);

            // Feed-forward input with state
            for (int i = 0; i < _cipherInput.Length; i++)
            {
                _digestState[i] ^= _cipherInput[i];
            }
        }
Example #4
0
        public void GenerateConfiguration(UInt64[] InitialState)
        {
            var cipher = new Threefish256();
            var tweak  = new UbiTweak();

            // Initialize the tweak value
            tweak.StartNewBlockType(UbiType.Config);
            tweak.IsFinalBlock  = true;
            tweak.BitsProcessed = 32;

            cipher.SetKey(InitialState);
            cipher.SetTweak(tweak.Tweak);
            cipher.Encrypt(ConfigString, ConfigValue);

            ConfigValue[0] ^= ConfigString[0];
            ConfigValue[1] ^= ConfigString[1];
            ConfigValue[2] ^= ConfigString[2];
        }
Example #5
0
        public void GenerateConfiguration(UInt64[] InitialState)
        {
            var cipher = new Threefish256();
            var tweak = new UbiTweak();

            // Initialize the tweak value
            tweak.StartNewBlockType(UbiType.Config);
            tweak.IsFinalBlock = true;
            tweak.BitsProcessed = 32;

            cipher.SetKey(InitialState);
            cipher.SetTweak(tweak.Tweak);
            cipher.Encrypt(ConfigString, ConfigValue);

            ConfigValue[0] ^= ConfigString[0];
            ConfigValue[1] ^= ConfigString[1];
            ConfigValue[2] ^= ConfigString[2];
        }