System.Security.Cryptography.HMACSHA1.Sha1.PadMessage C# (CSharp) Method

PadMessage() private method

private PadMessage ( Context ctx ) : void
ctx Context
return void
			void PadMessage(Context ctx)
			{
				if (ctx.MessageBlockIndex > 55)
				{
					ctx.MessageBlock[ctx.MessageBlockIndex++] = 0x80;

					while (ctx.MessageBlockIndex < 64)
						ctx.MessageBlock[ctx.MessageBlockIndex++] = 0;

					ProcessMessageBlock(ctx);

					while (ctx.MessageBlockIndex < 56)
						ctx.MessageBlock[ctx.MessageBlockIndex++] = 0;
				}
				else
				{
					ctx.MessageBlock[ctx.MessageBlockIndex++] = 0x80;

					while (ctx.MessageBlockIndex < 56)
						ctx.MessageBlock[ctx.MessageBlockIndex++] = 0;
				}

				ctx.MessageBlock[56] = (byte)(ctx.LengthHigh >> 24);
				ctx.MessageBlock[57] = (byte)(ctx.LengthHigh >> 16);
				ctx.MessageBlock[58] = (byte)(ctx.LengthHigh >> 08);
				ctx.MessageBlock[59] = (byte)ctx.LengthHigh;
				ctx.MessageBlock[60] = (byte)(ctx.LengthLow >> 24);
				ctx.MessageBlock[61] = (byte)(ctx.LengthLow >> 16);
				ctx.MessageBlock[62] = (byte)(ctx.LengthLow >> 08);
				ctx.MessageBlock[63] = (byte)ctx.LengthLow;

				ProcessMessageBlock(ctx);
			}
		}