Jump to content
Tuts 4 You

How This Code For Keygen In Asm?


Rumour

Recommended Posts

How this code for keygen in asm?

I must need a way and for chose random digits.

Example 4 digit ABCD are random.

But only thing: A+B+C+D must 26 (hex)

How do?

Link to comment

This is a snippet from a keygen for Puma products.

In this case I needed just 3 random decimal digits A+B+C = Integer Value. But this code could be extended to four decimal digits A+B+C+D

; ?????????????????????????????????????????????????????????????????????????

.data

testval dd 0

Val1 dd 0

Val2 dd 0

Val3 dd 0

.code

; ?????????????????????????????????????????????????????????????????????????

; Random

; generate a random number between 0 and nRange-1

Random PROC uses edx ecx nRange: DWORD

INVOKE GetTickCount

mov ecx, 41C64E6Dh

mul ecx

add eax, 3039h

and eax, 7FFFFFFh

mov ecx, nRange

sub edx, edx

div ecx

xchg eax, edx

ret

Random ENDP

; ?????????????????????????????????????????????????????????????????????????

; sumval is the integer value we want = A+B+C

; output A,B,C Val1,Val2,Val3

GenVals proc sumval :dword

tryagain:

mov eax, sumval

mov testval, eax

dec testval

invoke Random, testval

.if eax > 9

jmp tryagain

.endif

mov Val1, eax

mov eax, sumval

sub eax, Val1

mov testval, eax

dec testval

invoke Random, testval

.if eax > 9

jmp tryagain

.endif

mov Val2, eax

mov ebx, Val1

add eax, ebx

.if eax >= sumval

jmp tryagain

.else

mov ebx, eax

mov eax, sumval

sub eax, ebx

mov Val3, eax

.if eax > 9

jmp tryagain

.endif

.endif

ret

GenVals endp

; ?????????????????????????????????????????????????????????????????????????

If you code a four digit A+B+C+D = Integer example or find a better way - post it here :)

BTW what is the target for your keygen?

Z

Edited by Ziggy
Link to comment

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...