Exemplo n.º 1
0
        public int TransformBlock
        (
            byte[] bufIn,
            int nOfsIn,
            int nCount,
            byte[] bufOut,
            int nOfsOut
        )
        {
            // NOTE: we assume that the caller understands the meaning of
            //	     this method and that only even byte boundaries are
            //       given, thus we do not cache any data left internally

            int nResult = 0;

            if (null != m_bfc)
            {
                if (m_blIsEncryptor)
                {
                    nResult = m_bfc.Encrypt(bufIn, bufOut, nOfsIn, nOfsOut, nCount);
                }
                else
                {
                    nResult = m_bfc.Decrypt(bufIn, bufOut, nOfsIn, nOfsOut, nCount);
                }
            }
            else if (null != m_bf)
            {
                if (m_blIsEncryptor)
                {
                    nResult = m_bf.Encrypt(bufIn, bufOut, nOfsIn, nOfsOut, nCount);
                }
                else
                {
                    nResult = m_bf.Decrypt(bufIn, bufOut, nOfsIn, nOfsOut, nCount);
                }
            }
            else
            {
                nResult = 0;
            }

            return(nResult * Blowfish.BLOCKSIZE);
        }