On Sat June 6 2009, jaze lee wrote: > 2009/6/6 Rustam Rakhimov <rusyas...@gmail.com>: > > So if you are so brave try the example given before. > > Than you will feel reality. > may be you are wright, i try , but i can not get the result. > if a integer with m bits and another integer with n bits, if the > multiple , there product has m+n bits or m+n-1 bits. > 248911498900030209107 is a 21 bits number, so i think the p and q both > are 11 bits number. > i wrote a small program to find > #include <openssl/bn.h> > #include <openssl/bio.h> > #include <string.h> > > int main() { > BIO *filebio; > filebio = BIO_new(BIO_s_file()); > BIO_set_fp(filebio, stdout, BIO_NOCLOSE); > BN_CTX *mybnctx; > mybnctx = BN_CTX_new(); > BN_CTX_init(mybnctx); > BIGNUM *myprime; > BIGNUM *num1, *div, *rem; > char str1[] = "248911498900030209107"; > > num1 = BN_new(); > BN_dec2bn(&num1, str1); > div = BN_new(); > rem = BN_new(); > > int i; > for (i = 0; i < 10000; i++){ > /* > * i don't know how many the prime integer with 34 bits, > * so i just try,may be it is too naive think like this > */ > myprime = BN_generate_prime(NULL, 34, 0, NULL, NULL, NULL, > NULL); > BN_div(div, rem, num1, myprime, mybnctx); > if(BN_is_zero(rem)) { > /* if get it, then print them*/ > BIO_printf(filebio, "%s\n", BN_bn2dec(div)); > BIO_printf(filebio, "%s\n", BN_bn2dec(myprime)); > } > } > > BIO_free(filebio); > BN_free(num1); > BN_free(rem); > BN_free(div); > BN_free(myprime); > BN_CTX_free(mybnctx); > > } > > i still not understand the problem. although i don''t get the result. >
Now modify your program for a number of cryptographic size, say 4096 bits. Try again. Note: There are a lot of big number libraries, some much easier to use. http://www.walter-fendt.de/m14e/primes.htm Or ask Google about the subject. Or cheat a bit, here is a table of the primes upto 9 digits - A long, long way from 300 digits, but a start. ;) Notice also in your reading if the term "digits" is used - If not qualified, it usually means _decimal_ digits not binary digits (those are usually called "bits"). Mike > > > > > > ------------------------- > > Best Regards Rustam !!! > > > ______________________________________________________________________ > OpenSSL Project http://www.openssl.org > User Support Mailing List openssl-users@openssl.org > Automated List Manager majord...@openssl.org > > ______________________________________________________________________ OpenSSL Project http://www.openssl.org User Support Mailing List openssl-users@openssl.org Automated List Manager majord...@openssl.org