3

I'm developing an application where at some point i need an encoded stream of bytes based on the given user output.

Something like

Encoding sysEncode = System.Text.Encoding.GetEncoding(850);
byte[] dataToEncrypt = sysEncode.GetBytes(m_oStrActivation);

However when i extract the string from the byte stream i get the encrypted string as

W?????e?????W?X????;??2????W???????@

Is there any way(type of Encoding/equivalent) i can restrict these question marks and allow only plain scrambled alphanumeric characters ?

1 Answer 1

1

From m_oStrActivation and you mentioning "encryption" I assume that you're writing some kind of activation/licensing code. If this is the case, you're doing it wrong. A correct way to do this is to use a hash function over your activation data.

You can then transform this string into Base64 string using Convert.ToBase64String() method.

Sign up to request clarification or add additional context in comments.

1 Comment

To be clear for constantlearner - the System.Text.Encoding namespace has nothing to do with encryption - it's for dealing with character set code pages.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.