替换算法
如何使用 C# 代码在 ASP.NET 中执行替换加密算法?
请为我提供示例代码语法......
How to perform substitution encryption algorithm in ASP.NET using C# code ?
Please do provide me with sample code syntax....
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
实际上,ROT13 是 Caesar cipher 的变体,其思想是将纯文本的字母移动 N 个位置进一步在字母表中。 ROT13 或凯撒密码都不安全。为什么 ?
基本上,我们可以将加密强度定义为破解给定加密文本所需的工作量。那么我们应该怎么做才能打破这些呢? :
对于 N=1 到 26 执行:
将每个字符在字母表中向后移动 N 个位置。
如果有很多常见的英文单词(the, and, that,...) - 加密就被破解了。
所以在凯撒案例中仍然需要 26 次迭代来破解加密文本的数量如此之小,以至于我们可以有把握地说凯撒密码也没有安全性。 (不过当然比ROT13好一点)。
如果您想要更有用的替代密码,请使用 Vigenere 密码。与 ROT13/Caesar 密码相反 - Vigenere 密码在加密操作中不使用 FIXED 字母表。 (它通过按所需顺序切换来使用多个字母表)。这就是为什么 Vigenere 比 ROT13/Caesar 更安全。 Vigenere 仍然是弱加密,与XOR 加密相当。维热内尔为什么弱?基本上是因为它容易受到频率分析的影响(当然,首先需要猜测/查找密钥长度)。
这是 vigenere C# 代码(以及 Caesar/ROT13)。
祝你好运!
Actually ROT13 is a variant of Caesar cipher which idea is to shift letter of plain-text by N positions further in the alphabet. Neither ROT13 or Caesar cipher is secure. Why ?
Basically one can define encryption strength as amount of work one needs to do for breaking given encrypted text. So what we should do for breaking these ? :
for N=1 to 26 do:
shift each character by N positions back in the alphabet.
If a lot of common English words (the, and, that,...) - encryption is cracked.
So in Caesar case still 26 iterations for cracking encrypted text is so small number that we can safely claim that Caesar cipher has no security also. (But of course it is a bit better than ROT13).
If you want a bit more useful substitution cipher- then use Vigenere cipher. Contrary to ROT13/Caesar ciphers - Vigenere cipher doesn't use FIXED alphabet in encryption operation. (It uses several alphabets by switching them in required order). That is why Vigenere is more secure than ROT13/Caesar. Still Vigenere is weak encryption and is comparable to XOR encryption. Why Vigenere is weak ? Basically because it is vulnerable to Frequency analysis (of course at first one needs to guess/find key length).
Here it is vigenere C# code (along with Caesar/ROT13).
good luck!