Пример #1
0
 public override byte[] ProcessByte(byte input)
 {
     return(new byte[1]
     {
         cipher.ReturnByte(input)
     });
 }
Пример #2
0
    internal static void BcUpdateStream(this IStreamCipher cipher, ReadOnlySpan <byte> source, Span <byte> destination)
    {
        if (destination.Length < source.Length)
        {
            throw new ArgumentException(string.Empty, nameof(destination));
        }

        for (var i = 0; i < source.Length; ++i)
        {
            destination[i] = cipher.ReturnByte(source[i]);
        }
    }
Пример #3
0
        private void HCTest(IStreamCipher hc, string test, byte[] key, byte[] IV, byte[] expected)
        {
            KeyParameter     kp  = new KeyParameter(key);
            ParametersWithIV ivp = new ParametersWithIV(kp, IV);

            hc.Init(true, ivp);
            for (int i = 0; i < 64; i++)
            {
                if (hc.ReturnByte(MSG[i]) != expected[i])
                {
                    Fail(test + " failure at byte " + i);
                }
            }
        }
Пример #4
0
		private void HCTest(IStreamCipher hc, string test, byte[] key, byte[] IV, byte[] expected)
		{
			KeyParameter kp = new KeyParameter(key);
			ParametersWithIV ivp = new ParametersWithIV(kp, IV);

			hc.Init(true, ivp);
			for (int i = 0; i < 64; i++)
			{
				if (hc.ReturnByte(MSG[i]) != expected[i])
				{
					Fail(test + " failure at byte " + i);
				}
			}
		}