How do I encrypt a string and get a equal length encrypted string?

后端 未结 8 1044
南笙
南笙 2020-12-09 05:55

My problem is the following:

In an existing database I want to encrypt data in a couple of columns. The columns contains strings of different lengths.

I don\

8条回答
  •  萌比男神i
    2020-12-09 06:09

    Within your constrants, I would use AES in CFB mode, which turns it into a stream cipher and the output length will be the same as the input length. Unless you're storing the strings in blobs, you'll need to hex or base64 encode the output to make it char friendly, which will be a 100% or 33% increase in length.

    One .NET implementation is here.

提交回复
热议问题