某些文本的加密但加密值不应包含任何特殊字符 [英] Encryption of some text but encrypted value should not contain any special char

查看:469
本文介绍了某些文本的加密但加密值不应包含任何特殊字符的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要任何加密算法来加密我的文本或数值,但我的加密值不应包含任何特殊字符,它应该只是字母数字值。



提前谢谢。

I need any encryption algorithm which will encrypt my text or numeric value, But my encrypted value should not contain any special char it should be only alpha numeric value.

Thanks in advance.

推荐答案

加密算法不允许限制输出值:它们生成一个包含8位字节值的流,其中包含任何值范围0到255(含)。任何限制值的尝试都会导致无法解密的数据。



如果您需要一个可以通过纯文本频道发送的人类可读表格,然后考虑将加密的字节转换为十六进制(低效)或Base64 - (更高效,并为其设计): Convert.ToBase64String方法 [ ^ ]和 Convert.FromBase64String [ ^ ]



不要试图假设将原始数据转换为Base64提供任何安全性 - 它不是,它纯粹是一个翻译系统,根本不涉及加密。
Encryption algorithms don't allow you to limit the output values: they generate a stream of eight bit byte values which can contain any value in the range 0 to 255 inclusive. Any attempt to restrict the values will result in data which cannot be decrypted.

If you need a "human readable" form that can be sent over a Text only channel, then consider translate the encrypted bytes to either hex (inefficient) or Base64 - (more efficient, and designed for it): Convert.ToBase64String Method[^] and Convert.FromBase64String[^]

Do not be tempted to assume that converting your original data to Base64 will provide any security - it doesn't, it is purely a translation system, there is no encryption involved at all.


检查以下链接

它可能有用给你



http: //stackoverflow.com/questions/23210424/encryption-and-decryption-without-special-character [ ^ ]


这篇关于某些文本的加密但加密值不应包含任何特殊字符的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆