Click here to Skip to main content
15,905,616 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I am developing an application that requires company login as application loads. For company login, I have used three fields - Company Name, Password and Unlock String. The logic with these fields is; based on company name and password value, unlock string is to be generated. These three values will be given to client and the can login using these values.
I have been looking into a ways by which I can get a string based on two strings. Here using company name and password, a new string is to be generated that I will call unlock code.

What is the best practice for this logic in use in c#, asp.net. i had used RNGCryptoServiceProvider but it always returns dynamic value. I need unlock string to be static based on company name and password.

Any help!!!
Thanks in advance
Posted
Comments
Patrice T 19-Sep-15 7:30am    
In the field of app protection, if you ask 10 programmers, you will end with 11 different methods.

1 solution

I'd concatenate the two strings, and then return the hash value of those, as a BASE64 string.

If you use a standard hash - https://msdn.microsoft.com/en-us/library/system.security.cryptography.hashalgorithm%28v=vs.110%29.aspx?f=255&MSPPError=-2147217396[^] has quite a few - such as SHA or even MD5 (though that isn't recommended for new projects) it should be sufficiently unreadable. And if your concatenation is salted with a couple of special characters it won't be "guessable" unless they have your code to play with.
 
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