public override void Forward(NEncrypt.enc_args _enc_args, char key) { uint nSrcSize = _enc_args.nSrcSize; _enc_args.nSrcSize = _enc_args.uiSrcFileSize; _enc_args.nOutSize = _enc_args.nSrcSize + 24u; _enc_args.pOutBuf = new byte[_enc_args.nOutSize]; NEncrypt.Header header = new NEncrypt.Header(); Random random = new Random(); int num; if (key == ' ') { num = random.Next() % 25; } else { num = (int)key; } _enc_args.key = (byte)num + 65; header.Init(header, (long)((ulong)nSrcSize), key); byte[] pOutBuf = _enc_args.pOutBuf; byte[] array = header.Init(header, (long)((ulong)nSrcSize), key); for (int i = 0; i < array.Length; i++) { pOutBuf[i] = array[i]; } if (_enc_args.pOutBuf[6] == 3) { this.Type3_Forward(_enc_args.pSrcBuf, pOutBuf, nSrcSize, _enc_args.key); } }
public byte[] Init(NEncrypt.Header h, long lFileSize, char key = ' ') { Random random = new Random(); int num; if (key == ' ') { num = random.Next() % 25; } else { num = (int)key; } h.key = (byte)num + 65; h.id[0] = Convert.ToByte('N'); h.id[1] = Convert.ToByte('C'); h.id[2] = Convert.ToByte('R'); h.version = 1; h.encodeType = 3; h.iDataSize = (int)lFileSize; h.checkSum = 0; byte[] array = new byte[24]; for (int i = 0; i < 4; i++) { array[i] = h.id[i]; } byte[] bytes = BitConverter.GetBytes(h.version); int num2 = 0; for (int j = 4; j < 6; j++) { array[j] = bytes[num2]; num2++; } num2 = 0; bytes = BitConverter.GetBytes(h.encodeType); for (int k = 6; k < 8; k++) { array[k] = bytes[num2]; num2++; } num2 = 0; bytes = BitConverter.GetBytes(h.iDataSize); for (int l = 8; l < 12; l++) { array[l] = bytes[num2]; num2++; } array[12] = h.key; array[13] = h.checkSum; num2 = 0; for (int m = 14; m < 24; m++) { array[m] = this.reserved[num2]; } return(array); }