Click here to Skip to main content
15,890,717 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
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..
Posted
Updated 18-May-14 21:15pm
v2
Comments
Kornfeld Eliyahu Peter 19-May-14 3:07am    
If you are looking for fixed size (why?) output, you probably have to look for hash - in your case to a two way hash...
Manivignesh 19-May-14 3:21am    
ok thanks...could u give me code for generate 64 char using hash in c#?
Kornfeld Eliyahu Peter 19-May-14 3:29am    
No, but Google can!
Rob Philpott 19-May-14 5:07am    
Yes it can be done. You can encrypt 24 bytes of data into 24 bytes of encrypted data so with 64 bytes you've got plenty of room to play with. To do this, you need a key though. The pertinent question is how secure does it need to be?
Manivignesh 19-May-14 6:28am    
Yes it should be secured..and the important thing is that 64 character output should be able to Decrypt also..

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.
 
Share this answer
 
Comments
Manivignesh 19-May-14 3:21am    
ok thanks...could u give me code for generate 64 char using hash in c#?
Nelek 19-May-14 4:06am    
Did you really read the answer? He told you it is not possible to give you a "ready-to-go" solution. You are not giving any information and there are so many possibilities depending on what you really need, that is very difficult for people here to help.

Please read:
What have you tried?[^]
How to ask a question?[^]
Manivignesh 19-May-14 9:19am    
Thanks for the solution..actually i want the output of particular 64 characters from the given 24 characters input..My need is i want to set the output characters size from my side..if it is possible pls give the code..
The14thNoah 19-May-14 3:41am    
you can use google to search for it. . .internet is our best buddies for this programming-related-questions :)
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.


After decryption, remove the salt data to get back your original input.
 
Share this answer
 
Comments
Manivignesh 19-May-14 6:29am    
Thanks bro...can you explain this or give any example?i cant understand..
Manivignesh 19-May-14 9:16am    
Thanks for the solution..actually i want the output of particular 64 characters from the given 24 characters input..My need is i want to set the output characters size from my side..if it is possible pls give the code..

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900