Author Topic: Drizz Bignum lib  (Read 6654 times)

ragdog

  • Member
  • ****
  • Posts: 609
Drizz Bignum lib
« on: January 14, 2013, 12:11:42 AM »
Hi all

I use the BigNumlib from drizz in my project and have found a bug
Have any the email address from drizz?

I have only found this "1of00 AT gmx.net"

i am writing a program to create RSA keys like, p,q,d,n
using drizz's BigNum.lib
Now the flow is that a user should choose the keysize of n.
Knowing this when i get the keysize i divide it by 2 to get the keysize of p and q
but there is a problem using this method i never get the keysize that is wanted for n!

any idea how to circumvent this problem using the BigNum lib of drizz?

Code: [Select]
LOCAL p,q,n,e,d,phi,m,ct,z,x,y,a
pushad
RSATestBits equ 300  ;  > plain
invoke bnInit,RSATestBits
bnCreateX p,q,n,e,phi,d,m,ct,z

invoke Writeln,T("generating p...")
invoke bnRsaGenPrime,p,RSATestBits/2
invoke printbn,p
invoke Writeln,T("generating q...")
invoke bnRsaGenPrime,q,RSATestBits/2



Greets,
« Last Edit: January 14, 2013, 04:35:55 PM by ragdog »

dedndave

  • Member
  • *****
  • Posts: 8828
  • Still using Abacus 2.0
    • DednDave
Re: Drizz Bignum lib
« Reply #1 on: January 14, 2013, 01:11:08 AM »
haven't seen him around for a while   :(

but, i do know that his bignum library is in an "experimental" stage
meaning - use at your own risk - all things may not be perfect   :P

http://www.drizz.eu.pn/
i don't see an e-mail address

ragdog

  • Member
  • ****
  • Posts: 609
Re: Drizz Bignum lib
« Reply #2 on: January 14, 2013, 03:43:59 AM »
Yes i know

But it works only is a bug in this  bnRandom

Code: [Select]
bnRsaGenPrime proc bn:dword, nbit:dword
call _bn_dwrandomize
invoke bnRandom,bn,nbit             <<<<<<<<<<<<<<

It alloc to many or to little bit´s (dwords)

And i have the last Bignum lib from Drizz site

Gunther

  • Member
  • *****
  • Posts: 4115
  • Forgive your enemies, but never forget their names
Re: Drizz Bignum lib
« Reply #3 on: January 14, 2013, 04:50:04 AM »
Hi ragdog,

And i have the last Bignum lib from Drizz site

but it's from March 2010, nearly 3 years ago.

Gunther

You have to know the facts before you can distort them.

ragdog

  • Member
  • ****
  • Posts: 609
Re: Drizz Bignum lib
« Reply #4 on: January 14, 2013, 05:05:26 AM »
Yes this is this last build

qWord

  • Member
  • *****
  • Posts: 1475
  • The base type of a type is the type itself
    • SmplMath macros
Re: Drizz Bignum lib
« Reply #5 on: January 14, 2013, 05:16:11 AM »
looking into the source, you can find that bnRandom divides the number of bits nbit by 32 and discards the modulo - so it seems like that you can only get n*32 bits.
(Even it seems like that the library only work with multiples of DWORDs.)
MREAL macros - when you need floating point arithmetic while assembling!

ragdog

  • Member
  • ****
  • Posts: 609
Re: Drizz Bignum lib
« Reply #6 on: January 14, 2013, 05:45:05 AM »
Exact this is a problem.

Give from the Mircal lib a masm32 include?