))
    {
        memcpy(PT, pPlainBuffer, nLength);
        memset(PT+nLength, 0, len-nLength);
        memset(CT, 0, len);
        for(n = 0; n &lt; len; n++)
        {
            // Initialize CT with the key
            CT[n] ^= key[n%29]^(n%256);

            //for each bit in current BYTE
            for (b = 0; b &lt; 8; b++)
            {
                // if bit is set...
                if (PT[n] &amp; (1 &lt;&lt; b))
                {
                    // change bit number n%8 in CT[n-n%8+b]
 