Short encryption

D

Diablo

Hi,

I want to encrypt some short text. I've chosen Rijndael algorithm (AES)
for the encryption. The encryption process rounds the lenght of the
input string to a multiple of 16. Then I have to store the cipher
output in a database as string, with a MAXIMUM lenght of 100 chars. To
store the cipher output, I encode it to Base64 and then save it to the
database. But Base64 increases the lenght of the cipher by 33%, and
sometimes the resulting length exceeds 100 chars.

What is the best way of encrypting a string and the store it into a
database with the shortest length possible?

Thanks,
Diablo
 
D

DalePres

Try storing your cipher text as a varbinary instead of a varchar or char.
That will save you the overhead of Base64.

HTH

DalePres
MCAD, MCDBA, MCSE
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top