e-CryptIt Engine Xojo Plugin |

# BlowfishCBC.Encrypt Method (console safe)

Use this function to encrypt a block of data.
Because Blowfish works on blocks of 8 bytes then you get the best performance if the block size that you pass to it is dividable by 8. The class has built in cache technology so it will work if the the block size is not dividable by 8, but it will be slower.

Encrypt(
data as String) as String

#### Parameters

data
  The data to encrypt.

#### Returns

String

#### Remarks

If the total size of all blocks that you encrypt is not dividable by 8 then you will get 1 to 7 unencrypted bytes at the end. Because of that then you should add 7 bytes (PaddingBlockSize-1) of random bytes to the end of the encrypted stream to ensure that all of your data gets encrypted.
After you have finished encrypting all of the blocks then you should call FinishEncrypt which will let the encryptor clean up and it will return all unencrypted bytes there which should be part of the random bytes if you have done as descrbed above.

#### See Also

BlowfishCBC Class