Chinese string? What do you mean by that? There are not Chinese strings these days; there is only Unicode. Or do you mean one of the legacy encodings?
Now, why do you think you need to convert it to Base64String? What if I say that you need to convert it to array of byte, as it is always done? Use
System.Text.Encoding
to do that; see
http://msdn.microsoft.com/en-us/library/system.text.encoding.aspx[
^]. You could use any encoding except
System.Text.ASCIIEncoding
, of course; I would advise
System.Text.UTF8Encoding
.
Now, encryption. There is no such thing as "encrypt the resulted string using a 32 length key" — there is a number of algorithms. First, make a choice between symmetric or assymmetic algorithm. Please see
http://msdn.microsoft.com/en-us/library/system.security.cryptography.symmetricalgorithm.aspx[
^],
http://msdn.microsoft.com/en-us/library/system.security.cryptography.asymmetricalgorithm.aspx[
^].
You will need good understanding of the ideas of encryption, which are not trivial.
Start here:
http://en.wikipedia.org/wiki/Public-key_cryptography[
^] (these algorithms are assymmetric) and
http://en.wikipedia.org/wiki/Symmetric_key_algorithms[
^].
"Small length output"? Have you ever heard that there is no such thing as miracle? Ever heard of
informatics? See
http://en.wikipedia.org/wiki/Informatics_%28academic_field%29[
^].
[EDIT]
I just thought: if you require a small length output, maybe you mean not encryption but
cryptographic hash function (
http://en.wikipedia.org/wiki/Cryptographic_hash_function[
^])? This is not encryption but is a completely different thing. Encrypted data can be decrypted, in contrast to hashed data which is
irreversible, so it can be used only for comparison (and some related purposes). If so, I would advise using the algorithm from SHA family, see
http://en.wikipedia.org/wiki/SHA-2[
^]. For .NET implementation, see
http://msdn.microsoft.com/en-us/library/system.security.cryptography.hashalgorithm.aspx[
^].
—SA