在c#中将24个字符的字符串加密为64个字符? [英] Encrypt a 24 character string into 64 characters in c#?

查看:245
本文介绍了在c#中将24个字符的字符串加密为64个字符?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

hi friends ..如何将24个字符的字符串输入加密为64个字符?如果我解密64字符输出我想要相同的24字符输入回来..它是可能请给我解决方案..

hi friends..How to Encrypt a 24 character string input into 64 characters? And if i Decrypt the 64 character output i want the same 24 character input back..It is posible please give me the solution..

推荐答案

这不是真的我们可以回答的一个问题 - 根据您需要的复杂性和安全性,您可以通过多种方式实现这一目标。唯一的问题是固定大小的输出 - 很难预测输出的大小,因为大多数复杂的加密系统产生的块输出通常不是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.


< a href =http://stackoverflow.com/questions/10168240/encrypting-decrypting-a-string-in-c-sharp> http://stackoverflow.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.


这篇关于在c#中将24个字符的字符串加密为64个字符?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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