public String Encrypt(String plainText) { int i, origLen, len, mod; byte[] ueData, inBuf, outBuf, iv; ueData = Encoding.UTF8.GetBytes(plainText); origLen = ueData.Length; len = origLen; mod = len % BlowfishCBC.BLOCK_SIZE; len = (len - mod) + BlowfishCBC.BLOCK_SIZE; inBuf = new byte[len]; Array.Copy(ueData, 0, inBuf, 0, origLen); i = len - (BlowfishCBC.BLOCK_SIZE - mod); while (i < len) { inBuf[i++] = (byte)mod; } outBuf = new byte[inBuf.Length + BlowfishCBC.BLOCK_SIZE]; iv = new byte[BlowfishCBC.BLOCK_SIZE]; this.rng.GetBytes(iv); this.bfc.IV = iv; this.bfc.Encrypt( inBuf, 0, outBuf, BlowfishCBC.BLOCK_SIZE, inBuf.Length); Array.Copy(iv, 0, outBuf, 0, BlowfishCBC.BLOCK_SIZE); String sResult = Convert.ToBase64String(outBuf); Array.Clear(inBuf, 0, inBuf.Length); return sResult; }