ChupaChu Posted September 11, 2007 Posted September 11, 2007 I am coding a keygen, and im stuck. I'm writing it in Borlad Delphi 10.In target AL value is ROL-ed with CL value.e.g.ROL 16,32 would give 58 as result! (if using EAX and ECX one would get 580000 all in hex!)ROL 69,48 would give 69 as result! (if using EAX and ECX one would get 6900 all in hex!)Now this i canot do in delphi:1. ROL as such does not exist in delphi (so i cant implement asm code part (c/p) from source target).2. i tried using SHL - what gives correct/SAME values as ROL if calculating with dword values, but as i must calculate byte values (AL,CL) i get wrong result.3. implementing asm part in delphi with SHL al,cl gives me a [Pascal Error] : E2107 Operand size mismatch..Please recomend wht to do?Thank You!
Ufo-Pu55y Posted September 11, 2007 Posted September 11, 2007 (edited) Sry, I dunno the delphi syntax, but couldn't a byte rolingsimply being simulated like this ? int AL = 69 // or 16... take AL register int CL = 48 // or 32... take CL register while (CL > 0) { AL ^= 1; // means SHL AL,1 if (AL > 255) // is the 9th bit set ? ... AL -= 255; // .. then place it into the 1st one ! // Removing the 9th bit -> -256 // Setting the 1st bit -> +1 // ==> -255 :) CL--; } Edited September 11, 2007 by Ufo-Pu55y
ChupaChu Posted September 11, 2007 Author Posted September 11, 2007 Sry, I dunno the delphi syntax, but couldn't a byte rolingsimply being simulated like this ? int AL = 69 // or 16... take AL register int CL = 48 // or 32... take CL register while (CL > 0) { AL ^= 1; // means SHL AL,1 if (AL > 255) // is the 9th bit set ? ... AL -= 255; // .. then place it into the 1st one ! // Removing the 9th bit -> -256 // Setting the 1st bit -> +1 // ==> -255 :) CL--; }I got new delphi lite (v3) and now it works, i did it how zako recomended, so i have not tested your algo.Thanks m8's for helping me out!
Ufo-Pu55y Posted September 11, 2007 Posted September 11, 2007 AL ^= 1;There was a bug anyway.. oopsAL <<= 1;or AL *= 2;
ChupaChu Posted September 12, 2007 Author Posted September 12, 2007 AL ^= 1;There was a bug anyway.. oopsAL <<= 1; or AL *= 2; No problem, as i told earlier - i havent tryed it. I think "<<=" is less or equal but i havent got a clue what is "*=" I never tried any programing language that begins with a "c".. sorry.. Regards, ChupaChu!
human Posted September 12, 2007 Posted September 12, 2007 << is in c for shl not rol.and what a problem to code rol on al.you can mix it with shl and shr.8bit rol looks like it:and define just i and j as unsigned charreturn ((i << j) | (i >> (8 - j)));
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now