KirkSha1() публичный Метод

Creates a SHA1 Hash Command: 11, 0xB
public KirkSha1 ( byte OutputBuffer, byte InputBuffer, int InputSize ) : void
OutputBuffer byte
InputBuffer byte
InputSize int
Результат void
Пример #1
0
		public void TestSha1()
		{
			var Kirk = new Kirk();
			Kirk.kirk_init();

			var Input = new byte[] {
				// Size
				0x20, 0x00, 0x00, 0x00,
				// Data
				0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
				0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
			};

			var ExpectedOutput = new byte[]
			{
				0xDE, 0x8A, 0x84, 0x7B, 0xFF, 0x8C, 0x34, 0x3D, 0x69, 0xB8, 0x53, 0xA2,
				0x15, 0xE6, 0xEE, 0x77, 0x5E, 0xF2, 0xEF, 0x96
			};

			var Output = new byte[0x14];

			Assert.AreEqual(0x24, Input.Length);

			fixed (byte* OutputPtr = Output)
			fixed (byte* InputPtr = Input)
			{
				Kirk.KirkSha1(OutputPtr, InputPtr, Input.Length);
			}

			CollectionAssert.AreEqual(ExpectedOutput, Output);
			//Console.WriteLine(BitConverter.ToString(Hash));
		}