I want to encrypt string with the same length of character string and decryption with same length of character string using sql server. For Example:
我想使用相同长度的字符串加密字符串,并使用sql server以相同长度的字符串进行解密。例如:
Encryption
Input: Encrypt("002581") -- with 6 characters
Result: a&pE12 -- output with same 6 characters in encrypted form
Decryption
Input: Decrypt("a&pE12") -- with 6 characters
Result: 002581 -- output with same 6 characters in decrypted form
1 个解决方案
#1
-1
Short answer: there is no such secure encryption scheme.
简短回答:没有这样的安全加密方案。
Longer answer: any kind of encryption scheme obfuscates content of a plain text to be indistinguishable from other messages from the same message space. To do so all cipher texts produced must be of the same length (ideally) regardless of an input plain text. At least the length should be different from a length of a plain text.
更长的答案:任何类型的加密方案都会混淆纯文本的内容,使其与来自同一消息空间的其他消息无法区分。为此,无论输入纯文本如何,所有生成的密文必须具有相同的长度(理想情况下)。至少长度应该与纯文本的长度不同。
So please, don't even consider such an encryption technique. It's insecure by definition.
所以,请不要考虑这样的加密技术。根据定义它是不安全的。
#1
-1
Short answer: there is no such secure encryption scheme.
简短回答:没有这样的安全加密方案。
Longer answer: any kind of encryption scheme obfuscates content of a plain text to be indistinguishable from other messages from the same message space. To do so all cipher texts produced must be of the same length (ideally) regardless of an input plain text. At least the length should be different from a length of a plain text.
更长的答案:任何类型的加密方案都会混淆纯文本的内容,使其与来自同一消息空间的其他消息无法区分。为此,无论输入纯文本如何,所有生成的密文必须具有相同的长度(理想情况下)。至少长度应该与纯文本的长度不同。
So please, don't even consider such an encryption technique. It's insecure by definition.
所以,请不要考虑这样的加密技术。根据定义它是不安全的。