Click here to Skip to main content
15,741,215 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I need any encryption algorithm which will encrypt my text or numeric value, But my encrypted value should not contain any special char it should be only alpha numeric value.

Thanks in advance.
Tomas Takac 26-Nov-14 6:54am    
How about encrypting the text and then encoding the resulting byte[] in Base64?
suhel_khan 26-Nov-14 7:09am    
i don't want byte or base64 encoding tomas.
Tomas Takac 26-Nov-14 7:41am    
I think you don't understand. I mean first encrypt then convert the encrypted data using Base64. This is the same as OriginalGriff is suggesting in solution #1.

Encryption algorithms don't allow you to limit the output values: they generate a stream of eight bit byte values which can contain any value in the range 0 to 255 inclusive. Any attempt to restrict the values will result in data which cannot be decrypted.

If you need a "human readable" form that can be sent over a Text only channel, then consider translate the encrypted bytes to either hex (inefficient) or Base64 - (more efficient, and designed for it): Convert.ToBase64String Method[^] and Convert.FromBase64String[^]

Do not be tempted to assume that converting your original data to Base64 will provide any security - it doesn't, it is purely a translation system, there is no encryption involved at all.
Share this answer
suhel_khan 26-Nov-14 7:12am    
The issue is with the security only, I will pass the data to API which can be tempered easily and i cant pass special char in API also.To avoid this i need a encryption which can avoid special char as well.
Share this answer

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