更新时间:2023-02-12 18:52:18
这不是真的我们可以回答的一个问题 - 根据您需要的复杂性和安全性,您可以通过多种方式实现这一目标。唯一的问题是固定大小的输出 - 很难预测输出的大小,因为大多数复杂的加密系统产生的块输出通常不是64字节块。
所以从这里开始: Wiki加密 [ ^ ]并使用Google扩展到那里,或解释你想要实现的目标,我们会看看我们是否可以提供帮助 - 它可能是你正在走一条完全错误的大道!例如,如果这是用于密码,那么加密是一个糟糕的想法 - 您应该对数据进行散列,而不管输入大小如何,它总是产生固定大小的输出。
That isn't really a question we can just answer - there are a huge number of ways you could do that, depending on the complexity and security you need. The only problem is the fixed size output - it is difficult to predict the size of the output since most complicated encryption systems generate "block" outputs which aren't normally 64 byte blocks.
So start here: Wiki Encryption[^] and branch out fvrom there using Google, or explain what you are trying to achieve, and we'll see if we can help - it may be that you are going down a completely wrong avenue! For example, if this is for passwords, then encryption is a poor idea - you should be hashing your data instead, which always produces a fixed size output, regardless of the input size.
http://***.com/questions/10168240/encrypting-decrypting-a-string -in-c-sharp [ ^ ]
参考上面的链接
你可以使用任何类型算法
http ://msdn.microsoft.com/en-us/library/system.security.cryptography.des(v = vs.110).aspx [ ^ ]
这真的不难。
- 使用合适的最小块选择加密实现(例如
16
字节)。- 添加到您的输入
40
'salt'字节,加密所有。
That's really not difficult.
- Choose an encryption implementation using a suitable minimum block (for instance
16
bytes).- Add to your input
40
'salt' bytes, encrypt it all.