Click here to Skip to main content
16,019,018 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
Hi,

How to get encrypted string only in symbols, means it should not contain any letter or digit, and also the length of the encrypted string should be 25. Please provide decryption method also for the same.

Please reply.

Thanks..

What I have tried:

I tried encryption and decryption using TripleDESCryptoServiceProvider class which gives encrypted string, but I am not able to get encrypted string in only symbolic form and also can not limit the length. Is there any property or method to do this?
Posted
Updated 13-Nov-16 19:59pm
Comments
Suvendu Shekhar Giri 14-Nov-16 1:07am    
But why would need such a weird logic?
Can you brief us the requirement to do as such?
virus131 14-Nov-16 1:27am    
Actually it is my project's requirement that encrypted password should be in symbols only and length should not be greater than 25.
Please help..
Richard MacCutchan 14-Nov-16 4:04am    
Then you are expected to do the work.
F-ES Sitecore 14-Nov-16 4:13am    
It's an unreasonable requirement so push back on it, there is no valid reason why encrypted passwords should conform to this, your hands are tied by the encryption method you use. As suggested in Solution 1, if you use hashing instead then it's far easier to get a result that is 25 chars or less as hashing tends to result in shorter results.

1 solution

No. You cannot force a maximum length on encrypted data, as it is massively dependent on the length of the input data.
You should not be encrypting passwords anyway, you should be hashing them - see here: Password Storage: How to do it.[^]
Hashing does "fix" the length of the output data.
 
Share this answer
 
Comments
virus131 14-Nov-16 22:20pm    
Okkk... Got it.. thanks all..
OriginalGriff 15-Nov-16 2:14am    
You're welcome!

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