Reputation: 519
I need to convert some old authentication code from ASP to PHP. In the code which is being used to encrypt / decrypt passwords I stumbled upon lines like this
Char2 = Mid(sBASE_64_CHARACTERS, (((Byte2 And 240) \ 16) Or (SaveBits1 * 16) And &HFF) + 1, 1)
I really wonder how to translate this kind of code, especially how to deal with the (number And number) part.
Upvotes: 2
Views: 39
Reputation: 9142
Unfortunately there isn't an easy way to convert this without spending time. There is a neat tool you can use here... but you'll have to read the comments in the converted code as it will tell you there are assumptions -- such as user functions that aren't defined.. from there you'll need to write your own or try to figure it out.
But, to directly answer your question, those are bitwise operations and can be done such as Byte2 & 240
Upvotes: 3