Click here to Skip to main content
15,890,438 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
Hello there.
I have an encryption and decryption code in visual basic, so I'm trying to make it in C#, but I have a problem with the following code:
VB
Pass2 = Pass2 & Right("0" & Hex(Asc(Code) Xor Asc(CAR)), 2)


I don't know what can I do with the Hex, Asc and Xor functions or how can I change them.

I hope that someone can help me converting this or telling me what I need to do.

Thanks
Posted
Comments
Sergey Alexandrovich Kryukov 30-Jul-12 18:37pm    
What do you call VB? Is it VB.NET or not? VB and VB.NET are very different languages...
Your "I don't know how..." is not informative; you need to describe your goal, expected behavior and explain what's the problem.
--SA
Sergey Alexandrovich Kryukov 30-Jul-12 18:39pm    
Ah, you just needed to translate, not "pass". Expressing yourself clearly is important...
--SA

1 solution

According to this converter[^]:
C#
Pass2 = Pass2 + Strings.Right("0" + Conversion.Hex(Strings.Asc(Code) ^ Strings.Asc(CAR)), 2)


(Well actually it thought it was a comparison, but I changed it because it looks like an assignment to me.)
 
Share this answer
 
Comments
EddyGuzman 30-Jul-12 18:04pm    
It works nice, just need to add the reference for VB to use it without problems. BTW you're right. it was an assignment...
Thanks
Sergey Alexandrovich Kryukov 30-Jul-12 18:39pm    
Answered, my 5.
--SA

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