EncryptByPassPhrase automatically adds metadata to the encrypted result. If the authenticator is not used, the size of the metadata seems to be 20 bytes (as for SQL Server 2012 Express).Therefore, the overall size of the encrypted varchar data considering the size of the metadata, the TRIPLE DES 8-byte alignment and the trailing zero byte could be calculated as follows:CEILING((CAST(DATALENGTH(@cleartext) as float) + 1) / 8) * 8 + 20So, for example, an encrypted version of the 320 characters lon
↧