my asm bignum library is released (v.0.01a) on my website (
it is slow as hell, and might be bugged, but it might help to do some rsa, or whatever, in asm =)
critics welcomed
Posted on 2002-02-16 09:10:58 by roy

you might want to speed up your powmod code a little ;) (seems like you're currently using a binary method).
you could try a sliding window technique (faster, but still pretty slow ;)) or - even better - get some info on montgomery multiplication/exponentiation.
try and implement a squaring function as well (will be ~2 times faster than multiplying a number by itself using the multiplication function).

Posted on 2002-02-16 09:59:39 by Tola
Nice work ;)
Posted on 2002-02-16 10:04:34 by ThrawN
yes, the powmod algorithm is real slow, i' ll try to recode my mul, and i already planned to make a square =) i think the worst thing is not the lame way i coded it, but more that i used lame algos =) anyway, for small need, it can be already used =)
i should make it a .lib instead of including the files, i' ll work on this too

thanks thrawn =)
Posted on 2002-02-17 04:40:55 by roy
i updated my bignum library
biglib v.0.01b can be found at
feel free to criticize
Posted on 2002-03-16 09:08:52 by roy

i made some correction to my bignum library
to get v.0.01c :
Posted on 2002-03-20 14:27:31 by roy
biglib v.0.001e released
bug in memory deallocation fixed
Posted on 2002-05-12 13:56:29 by roy
roy, I've always liked the design of your site - very elegant.
Also, I am unable to download the updated source.
Posted on 2002-05-12 20:26:07 by bitRAKE
404 error
Posted on 2002-05-12 20:47:58 by The Svin

_BigAdd32 proc uses ebx ecx edi esi,pBigx:dword,dtValue:dword,pBigy:dword

invoke _BigCopy,pBigx,pBigy

mov ecx,dtValue
test ecx,ecx
jz __ret

mov edi,pBigy
mov esi,edi
mov edx,dword ptr [edi]

add edi,4
add dword ptr [edi],ecx

jnc __doneadd

__addcarry: lea edi,[edi+4] ; lea becuase we are not allowed to change to flags?
adc dword ptr [edi],0
dec edx
jc __addcarry

__doneadd: test edx,edx
ja __ret ;why ja? shouldn taht be jz ?

inc dword ptr [esi]

__ret: ret

_BigAdd32 endp

Posted on 2002-05-13 05:30:55 by eko

thanks bitrake =)
i fixed the problem, you should be able to download it now (
i' ll check the _bigadd comments as soon as possible, thanks for checking the code, please do post critics and comments =)
Posted on 2002-05-13 13:25:10 by roy
roy, I had a quick look at _BigAdd32
you don't need clc there, since following adds changes CF anyway.
Posted on 2002-05-13 14:48:37 by The Svin
A couple simple ideas with comments:

_BigAdd32 proc uses ebx ecx edi esi,pBigx:dword,dtValue:dword,pBigy:dword

; invoke _BigCopy,pBigx,pBigy
mov esi,pBigy ;you need pBigy anyway put it at start
invoke _BigCopy,pBigx,esi ;! it will allow to use it here that is faster and shorter

mov ecx,dtValue
test ecx,ecx
jz __ret

; mov edi,pBigy
; mov esi,edi
lea edi,[esi][4] ;! value aready in esi instead of mov + add we do lea once

; mov edx,dword ptr [edi]
mov edx,[esi] ;pBigy in esi now

; clc ;don't need it - add will change CF anyway
; add edi,4 ;already done by lea
add dword ptr [edi],ecx
Posted on 2002-05-13 15:05:48 by The Svin