views:

82

answers:

2

I use some code to encrypt & decrypt string in C# but i want a good one that can generate encrypted string that contain only letters or numbers not any other ( + , / , ...)
Is there good one for that ?

A: 

It depends what your "STRING" represent , if it is Password or some sort of valuable thing than would say that use specilized classes in .net like Cryptography.

saurabh
i encrypt numbers
Space Cracker
@Space: Your question says "string".
Ignacio Vazquez-Abrams
+8  A: 

You could use any encryption algorithm, then encode the result. Once you have binary data, you can push it out to any textual format. The result of an encryption algorithm is going to be a series of bytes, anyhow, so any textual representation is simply an encoding.

Hexadecimal would be fairly large, depending on your encrypted data. Base64 would almost encode it the way you want, except for the / and + symbols. Base32 would probably be the way to go, because it is A-Z, 2-7 and = for padding.

If you want to custom tailor your own encoding scheme, that is also an option, and would be very easy to implement. For example, you could take Base32, and replace the padding with 8, then you'd have just A-Z, 2-8.

Merlyn Morgan-Graham
Is there any way to encode also the / and + symbols.
Space Cracker
Base32 uses characters A-Z and 2-7. http://en.wikipedia.org/wiki/Base32. You can use that
Merlyn Morgan-Graham