public int DoFinal( byte[] output, int outOff) { int blockSize = cipher.GetBlockSize(); if (padding == null) { // pad with zeroes while (bufOff < blockSize) { buf[bufOff++] = 0; } } else { if (bufOff == blockSize) { cipher.ProcessBlock(buf, 0, mac, 0); bufOff = 0; } padding.AddPadding(buf, bufOff); } cipher.ProcessBlock(buf, 0, mac, 0); // Added to code from base class DesEngine deseng = new DesEngine(); deseng.Init(false, this.lastKey2); deseng.ProcessBlock(mac, 0, mac, 0); deseng.Init(true, this.lastKey3); deseng.ProcessBlock(mac, 0, mac, 0); // **** Array.Copy(mac, 0, output, outOff, macSize); Reset(); return macSize; }