Click here to Skip to main content
16,011,804 members
Please Sign up or sign in to vote.
2.50/5 (2 votes)
See more:
Hi..I need code to generate 64 character key from the combination of my two inputs(having 12 digits each).And that 64 character output should be unique..if i give the same inputs again the out also should be same..
It is possible please give solution..
Posted
Comments
King Fisher 9-May-14 3:49am    
We are not Providing any code .What you have Tried First?

Probably the best way to do this would be to use a hashing function: SHA256 produces a 256 bit output regardless of the input length, which equates to a 64 hex digit (ie 64 printable characters) output.

See here: SHA256 Class[^]
 
Share this answer
 
Any deterministic algorithm would do the trick. For instance simply concatenating the input keys would work:
C#
string k1 = "123456789012";
string k2 = "135792468013";
string kr = k1 + k2 + k1 + k2 + k1 + k2.SubString(0,4);
 
Share this answer
 
Comments
Manivignesh 9-May-14 7:37am    
ok thanks for the code...one more clarification... if i give only one input(12 digit string) i want 64 character unique key..so can you give the solution
CPallini 9-May-14 8:16am    
That's just a dumb example. However it would be enough to replace every occurrence of k2 with k1 in the third line.
Manivignesh 9-May-14 9:05am    
Thanks buddy...
CPallini 9-May-14 9:08am    
You are welcome.
Matt T Heffron 9-May-14 13:17pm    
UNLESS omitting k2 is DIFFERENT from omitting k1 ;-)

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