Ejemplo n.º 1
0
 private void ReadWords(byte[] key, uint[] words)
 {
     for (int i = 0; i < key.Length / 4; i++)
     {
         words[i] = Word32Bits.ToUint(key.SubArray(i * 4, i * 4 + 4));
     }
 }
Ejemplo n.º 2
0
        public void ToUint_ConvertsToUintLittleEndian_Converted()
        {
            byte[] bytes    = { 2, 108, 209, 77 };
            uint   excepted = 40685901;

            Assert.AreEqual(excepted, Word32Bits.ToUint(bytes, ValueRepresentation.LittleEndian));
        }
Ejemplo n.º 3
0
        public void ToUint_ConvertsToUint_Converted()
        {
            byte[] bytes    = { 2, 108, 209, 77 };
            uint   excepted = 1305570306;

            Assert.AreEqual(excepted, Word32Bits.ToUint(bytes));
        }
Ejemplo n.º 4
0
        private uint ReadWord()
        {
            var bytes = new byte[_bytesPerWord];

            for (int i = 0; i < _bytesPerWord; i++)
            {
                bytes[i] = ReadByte();
            }
            return(Word32Bits.ToUint(bytes));
        }
Ejemplo n.º 5
0
        private uint[] SplitInto32BitWords(byte[] m)
        {
            int BYTES_PER_WORD = 4;
            var M = new uint[m.Length / BYTES_PER_WORD];

            for (int i = 0; i < M.Length; i++)
            {
                M[i] = Word32Bits.ToUint(m.SubArray(i * 4, i * 4 + 4));
            }

            return(M);
        }