private static bytesToint ( byte inBytes, int inOff ) : int | ||
inBytes | byte | |
inOff | int | |
return | int |
private static int bytesToint(
byte[] inBytes,
int inOff)
{
return (int)((inBytes[inOff + 3] << 24) & 0xff000000) + ((inBytes[inOff + 2] << 16) & 0xff0000) +
((inBytes[inOff + 1] << 8) & 0xff00) + (inBytes[inOff] & 0xff);
}
private int[] generateWorkingKey(bool forEncryption, byte[] userKey) { this.forEncryption = forEncryption; if (userKey.Length != 32) { throw new ArgumentException("Key length invalid. Key needs to be 32 byte - 256 bit!!!"); } int[] array = new int[8]; for (int num = 0; num != 8; num++) { array[num] = Gost28147Engine.bytesToint(userKey, num * 4); } return(array); }