It is currently Tue Sep 17, 2019 7:46 am

All times are UTC + 1 hour




Post new topic Reply to topic  [ 1 post ] 
Author Message
 Post subject: LibTom
PostPosted: Fri Aug 16, 2019 12:37 pm 
Offline
Addict
Addict

Joined: Fri Apr 25, 2003 11:10 pm
Posts: 1199
LibTomMath is a free open source BigInt library https://www.libtom.net released in the Public Domain http://unlicense.org/
to compile using VC first edit makefile.msvc and add /GS- to LTM_CFLAGS so it will look like
Code:
LTM_CFLAGS  = /nologo /I./ /D_CRT_SECURE_NO_WARNINGS /D_CRT_NONSTDC_NO_DEPRECATE /W3 /GS- $(CFLAGS)

otherwise Polink will bark at you about '__security_cookie'
I would also recommend adding /O2 for optimization

from the command window run vcvarsall.bat with x86 or amd64, like so
Code:
for 32-bit
"C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\vcvarsall.bat" x86

for 64-bit
"C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\vcvarsall.bat" amd64

after that, cd into the LibTomMath directory and run nmake like so
Code:
nmake -f makefile.msvc all

run test.exe
if all is ok, then copy tommath.lib to your PB libraries folder
here's and old example, perhaps not up-to-date, but it will get you started
there are two tests, enable one or the other
note that the constants, macros and structure are valid on windows, MSVC does not have 128-bit integers, other platforms may have them, and so, some of the macros, constants and structure will be different
Code:
Macro mp_digit
  l
EndMacro
Macro ulong64
  q
EndMacro
Macro long64
  q
EndMacro
Macro mpword
  q
EndMacro

Macro mp_word
  mpword
EndMacro
Macro mp_err
  l
EndMacro

Structure mp_int Align #PB_Structure_AlignC
   used.l
   alloc.l
   sign.l
   *dp
EndStructure

#DIGIT_BIT = 28
#MP_DIGIT_BIT = #DIGIT_BIT
#MP_LT = -1
#MP_EQ = 0
#MP_GT = 1
#MP_ZPOS = 0
#MP_NEG = 1
#MP_OKAY = 0
#MP_MEM = -2
#MP_VAL = -3
#MP_RANGE = #MP_VAL
#MP_ITER = -4
#MP_YES = 1
#MP_NO = 0
#LTM_PRIME_BBS = $0001
#LTM_PRIME_SAFE = $0002
#LTM_PRIME_2MSB_ON = $0008
#MP_PREC = 32
#PRIME_SIZE = 256 ;number of primes in ltm_prime_tab()
ImportC "tommath.lib"
  ;KARATSUBA_MUL_CUTOFF.l
  ;KARATSUBA_SQR_CUTOFF.l
  ;TOOM_MUL_CUTOFF.l
  ;TOOM_SQR_CUTOFF.l
  ;ltm_prime_tab.mp_digit  ;the first 256 primes
  ;mp_s_rmap.s
  mp_error_to_string (code.l) ;char*
  mp_init.l (*a.mp_int)
  mp_clear (*a.mp_int)
  ;mp_init_multi.l (*mp.mp_int,)
  ;mp_clear_multi (*mp.mp_int,)
  mp_exch (*a.mp_int, *b.mp_int)
  mp_shrink.l (*a.mp_int)
  mp_grow.l (*a.mp_int, Size.l)
  mp_init_size.l (*a.mp_int, Size.l)
  mp_zero (*a.mp_int)
  mp_set (*a.mp_int, b.mp_digit)
  mp_set_int.l (*a.mp_int, b.l)
  mp_get_int.l (*a.mp_int)
  mp_init_set.l (*a.mp_int, b.mp_digit)
  mp_set_double.l (*a.mp_int, b.d)
  mp_init_set_int.l (*a.mp_int, b.l)
  mp_set_long.l (*a. mp_int, b.l)
  mp_set_long_long.l (*a.mp_int, b.q)
  mp_get_double.d (*a.mp_int)
  mp_get_long.l (*a.mp_int)
  mp_get_long_long.q (*a. mp_int)
  mp_copy.l (*a.mp_int, *b.mp_int)
  mp_init_copy.l (*a.mp_int, *b.mp_int)
  mp_clamp (*a.mp_int)
  mp_rshd (*a.mp_int, b.l)
  mp_lshd.l (*a.mp_int, b.l)
  mp_div_2d.l (*a.mp_int, b.l, *c.mp_int, *d.mp_int)
  mp_div_2.l (*a.mp_int, *b.mp_int)
  mp_mul_2d.l (*a.mp_int, b.l, *c.mp_int)
  mp_mul_2.l (*a.mp_int, *b.mp_int)
  mp_mod_2d.l (*a.mp_int, b.l, *c.mp_int)
  mp_2expt.l (*a.mp_int, b.l)
  mp_cnt_lsb.l (*a.mp_int)
  mp_rand.l (*a.mp_int, digits.l)
  mp_xor.l (*a.mp_int, *b.mp_int, *c.mp_int)
  mp_or.l (*a.mp_int, *b.mp_int, *c.mp_int)
  mp_and.l (*a.mp_int, *b.mp_int, *c.mp_int)
  mp_neg.l (*a.mp_int, *b.mp_int)
  mp_abs.l (*a.mp_int, *b.mp_int)
  mp_cmp.l (*a.mp_int, *b.mp_int)
  mp_cmp_mag.l (*a.mp_int, *b.mp_int)
  mp_add.l (*a.mp_int, *b.mp_int, *c.mp_int)
  mp_sub.l (*a.mp_int, *b.mp_int, *c.mp_int)
  mp_mul.l (*a.mp_int, *b.mp_int, *c.mp_int)
  mp_sqr.l (*a.mp_int, *b.mp_int)
  mp_div.l (*a.mp_int, *b.mp_int, *c.mp_int, *d.mp_int)
  mp_mod.l (*a.mp_int, *b.mp_int, *c.mp_int)
  mp_cmp_d.l (*a.mp_int, b.mp_digit)
  mp_add_d.l (*a.mp_int, b.mp_digit, *c.mp_int)
  mp_sub_d.l (*a.mp_int, b.mp_digit, *c.mp_int)
  mp_mul_d.l (*a.mp_int, b.mp_digit, *c.mp_int)
  mp_div_d.l (*a.mp_int, b.mp_digit, *c.mp_int, *d.INTEGER)
  mp_div_3.l (*a.mp_int, *c.mp_int, *d.INTEGER)
  mp_expt_d.l (*a.mp_int, b.mp_digit, *c.mp_int)
  mp_mod_d.l (*a.mp_int, b.mp_digit, *c.INTEGER)
  mp_addmod.l (*a.mp_int, *b.mp_int, *c.mp_int, *d.mp_int)
  mp_submod.l (*a.mp_int, *b.mp_int, *c.mp_int, *d.mp_int)
  mp_mulmod.l (*a.mp_int, *b.mp_int, *c.mp_int, *d.mp_int)
  mp_sqrmod.l (*a.mp_int, *b.mp_int, *c.mp_int)
  mp_invmod.l (*a.mp_int, *b.mp_int, *c.mp_int)
  mp_gcd.l (*a.mp_int, *b.mp_int, *c.mp_int)
  mp_exteuclid.l (*a.mp_int, *b.mp_int, *U1.mp_int, *U2.mp_int, *U3.mp_int)
  mp_lcm.l (*a.mp_int, *b.mp_int, *c.mp_int)
  mp_n_root.l (*a.mp_int, b.mp_digit, *c.mp_int)
  mp_sqrt.l (*arg.mp_int, *ret.mp_int)
  mp_is_square.l (*arg.mp_int, *ret.LONG)
  mp_jacobi.l (*a.mp_int, *n.mp_int, *c.LONG)
  mp_reduce_setup.l (*a.mp_int, *b.mp_int)
  mp_reduce.l (*a.mp_int, *b.mp_int, *c.mp_int)
  mp_montgomery_setup.l (*a.mp_int, *mp.INTEGER)
  mp_montgomery_calc_normalization.l (*a.mp_int, *b.mp_int)
  mp_montgomery_reduce.l (*a.mp_int, *m.mp_int, mp.mp_digit)
  mp_dr_is_modulus.l (*a.mp_int)
  mp_dr_setup (*a.mp_int, *d.INTEGER)
  mp_dr_reduce.l (*a.mp_int, *b.mp_int, mp.mp_digit)
  mp_reduce_is_2k.l (*a.mp_int)
  mp_reduce_2k_setup.l (*a.mp_int, *d.INTEGER)
  mp_reduce_2k.l (*a.mp_int, *n.mp_int, d.mp_digit)
  mp_reduce_is_2k_l.l (*a.mp_int)
  mp_reduce_2k_setup_l.l (*a.mp_int, *d.mp_int)
  mp_reduce_2k_l.l (*a.mp_int, *n.mp_int, *d.mp_int)
  mp_exptmod.l (*a.mp_int, *b.mp_int, *c.mp_int, *d.mp_int)
  mp_prime_is_divisible.l (*a.mp_int, *result.LONG)
  mp_prime_fermat.l (*a.mp_int, *b.mp_int, *result.LONG)
  mp_prime_miller_rabin.l (*a.mp_int, *b.mp_int, *result.LONG)
  mp_prime_rabin_miller_trials.l (size.l)
  mp_prime_is_prime.l (*a.mp_int, t.l, *result.LONG)
  mp_prime_next_prime.l (*a.mp_int, t.l, bbs_style.l)
  mp_prime_random_ex.l (*a.mp_int, t.l, size.l, flags.l, *cb, *dat)
  mp_count_bits.l (*a.mp_int)
  mp_unsigned_bin_size.l (*a.mp_int)
  mp_read_unsigned_bin.l (*a.mp_int, *b.BYTE, c.l)
  mp_to_unsigned_bin.l (*a.mp_int, *b.BYTE)
  mp_to_unsigned_bin_n.l (*a.mp_int, *b.BYTE, *outlen.LONG)
  mp_signed_bin_size.l (*a.mp_int)
  mp_read_signed_bin.l (*a.mp_int, *b.BYTE, c.l)
  mp_to_signed_bin.l (*a.mp_int, *b.BYTE)
  mp_to_signed_bin_n.l (*a.mp_int, *b.BYTE, *outlen.LONG)
  mp_read_radix.l (*a.mp_int, str.p-ascii, radix.l)
  mp_toradix.l (*a.mp_int, *string, radix.l)
  mp_toradix_n.l (*a.mp_int, str.s, radix.l, maxlen.l)
  mp_radix_size.l (*a.mp_int, radix.l, *size.LONG)
  mp_fread.l (*a.mp_int, radix.l, *stream)
  mp_fwrite.l (*a.mp_int, radix.l, *stream)
  s_mp_add.l (*a.mp_int, *b.mp_int, *c.mp_int)
  s_mp_sub.l (*a.mp_int, *b.mp_int, *c.mp_int)
  fast_s_mp_mul_digs.l (*a.mp_int, *b.mp_int, *c.mp_int, digs.l)
  s_mp_mul_digs.l (*a.mp_int, *b.mp_int, *c.mp_int, digs.l)
  fast_s_mp_mul_high_digs.l (*a.mp_int, *b.mp_int, *c.mp_int, digs.l)
  s_mp_mul_high_digs.l (*a.mp_int, *b.mp_int, *c.mp_int, digs.l)
  fast_s_mp_sqr.l (*a.mp_int, *b.mp_int)
  s_mp_sqr.l (*a.mp_int, *b.mp_int)
  mp_karatsuba_mul.l (*a.mp_int, *b.mp_int, *c.mp_int)
  mp_toom_mul.l (*a.mp_int, *b.mp_int, *c.mp_int)
  mp_karatsuba_sqr.l (*a.mp_int, *b.mp_int)
  mp_toom_sqr.l (*a.mp_int, *b.mp_int)
  fast_mp_invmod.l (*a.mp_int, *b.mp_int, *c.mp_int)
  mp_invmod_slow.l (*a.mp_int, *b.mp_int, *c.mp_int)
  fast_mp_montgomery_reduce.l (*a.mp_int, *m.mp_int, mp.mp_digit)
  mp_exptmod_fast.l (*G.mp_int, *X.mp_int, *P.mp_int, *Y.mp_int, mode.l)
  s_mp_exptmod.l (*G.mp_int, *X.mp_int, *P.mp_int, *Y.mp_int, mode.l)
  bn_reverse (*s.BYTE, len.l)
  mp_import.l (*rop.mp_int, count.i, order.l, size.i, endian.l, nails.i, *op)
  mp_export.l (*rop, *countp.INTEGER, order.l, size.i, endian.l, nails.i, *op.mp_int)
  mp_get_bit.l (*a.mp_int, b.l)
  mp_tc_xor.l (*a.mp_int, *b.mp_int, *c.mp_int)
  mp_tc_or.l (*a.mp_int, *b.mp_int, *c.mp_int)
  mp_tc_and.l (*a.mp_int, *b.mp_int, *c.mp_int)
  mp_tc_div_2d.l (*a.mp_int, b.l, *c.mp_int)
  mp_complement.l (*a.mp_int, *b.mp_int)
  mp_expt_d_ex.l (*a.mp_int, b.mp_digit, *c.mp_int, fast.l)
  mp_n_root_ex.l (*a.mp_int, b.mp_digit, *c.mp_int, fast.l)
  mp_sqrtmod_prime.l (*n.mp_int, *prime.mp_int, *ret.mp_int)
  mp_kronecker.l (*a.mp_int, *p.mp_int, *c.LONG)
  mp_prime_strong_lucas_selfridge.l (*a.mp_int, *result.LONG)
  mp_prime_frobenius_underwood.l (*N.mp_int, *result.LONG)

EndImport

;Dim ltm_prime_tab.l(255)
;CopyMemory(@ltm_prime_tab, @ltm_prime_tab(), #PRIME_SIZE*4)
CompilerIf 1
Define.mp_int i, j, k, y
s.s
s=s+"2B7E151628AED2A6ABF7158809CF4F3C762E7160F38B4DA56A784D9045190CFEF324E77"
s=s+"38926CFBE5F4BF8D8D8C31D763DA06C80ABB1185EB4F7C7B5757F5958490CFD47D7C19"
s=s+"BB42158D9554F7B46BCED55C4D79FD5F24D6613C31C3839A2DDF8A9A276BCFBFA1C877"
s=s+"C56284DAB79CD4C2B3293D20E9E5EAF02AC60ACC93ED874422A52ECB238FEEE5AB6ADD"
s=s+"835FD1A0753D0A8F78E537D2B95BB79D8DCAEC642C1E9F23B829B5C2780BF38737DF8B"
s=s+"B300D01334A0D0BD8645CBFA73A6160FFE393C48CBBBCA060F0FF8EC6D31BEB5CCEED7"
s=s+"F2F0BB088017163BC60DF45A0ECB1BCD289B06CBBFEA21AD08E1847F3F7378D56CED94"
s=s+"640D6EF0D3D37BE67008E186D1BF275B9B241DEB64749A47DFDFB96632C3EB061B6472"
s=s+"BBF84C26144E49C2D04C324EF10DE513D3F5114B8B5D374D93CB8879C7D52FFD72BA0A"
s=s+"AE7277DA7BA1B4AF1488D8E836AF14865E6C37AB6876FE690B571121382AF341AFE94F"
s=s+"77BCF06C83B8FF5675F0979074AD9A787BC5B9BD4B0C5937D3EDE4C3A79396215EDAB1"
s=s+"F57D0B5A7DB461DD8F3C75540D00121FD56E95F8C731E9C4D7221BBED0C62BB5A87804"
s=s+"B679A0CAA41D802A4604C311B71DE3E5C6B400E024A6668CCF2E2DE86876E4F5C50000"
s=s+"F0A93B3AA7E6342B302A0A47373B25F73E3B26D569FE2291AD36D6A147D1060B871A28"
s=s+"01F9783764082FF592D9140DB1E9399DF4B0E14CA8E88EE9110B2BD4FA98EED150CA6D"
s=s+"D8932245EF7592C703F532CE3A30CD31C070EB36B4195FF33FB1C66C7D70F93918107C"
s=s+"E2051FED33F6D1DE9491C7DEA6A5A442E154C8BB6D8D0362803BC248D414478C2AFB07"
s=s+"FFE78E89B9FECA7E3060C08F0D61F8E36801DF66D1D8F9392E52CAEF0653199479DF2B"
s=s+"E64BBAAB008CA8A06FDACE9CE70489845A082BA36D611E99F2FBE724246D18B54E335C"
s=s+"AC0DD1AB9DFD7988A4B0C4558AA119417720B6E150CE2B927D48D7256E445E333CB757"
s=s+"2B3BD00FB2746043189CAC116CEDC7E771AE0358FF752A3A6B6C79A58A9A549B50C587"
s=s+"0690755C35E4E36B529038CA733FD1AAA8DAB40133D80320E0790968C76546B993F6C8"
s=s+"FF3B2542750DA1FFADA7B74731782E330EF7D92C43BE1AD8C50A8EAE20A5556CBDD1F2"
s=s+"4C99972CB03C73006F5C08A4E220E74ABC179151412B1E2DD60A08A11B02E8D70D7D71"
s=s+"645833011BF60945507F1A32721AC08AEDC2661DA91839D146A2A4C425C0FFB87085F9"
s=s+"B0E09B94B146A9A4783908F3F267A78C59430485ED89205B36B66A57E756E006522367"
s=s+"028287F8C1D695DF88C60FE07528FCBE915C7BF23382EA293FA2DA1577F9CAC299BB7B"
s=s+"4BEEAFEF9628C3EBEAF87175C6A1F8BDD07BE307FA1BFA9AEFF794C19DFC365F447527"
s=s+"DEA110F4208B941AA7D185380478AA520E3FE2335A322EDF147BBDB527AA2AD3CB0F7D"
s=s+"6ED381CD6AC35A1D24BF89B75019605AEE9DFABA5CFCED033BA2102A0BDBE3B49D7272"
s=s+"F89E09D008E5D5BD99239362861EB426297C5841397515473CF2A3D6DE58C4BB1B91AD"
s=s+"97ABF028E9665DA4ECE80DDC13E0DF4322EDA0FD389B175E8D10D08C5230A6B576C94F"
s=s+"C52B4E74B2E3420E902C82EE7AEB805C2EB76517EABFFB8777378C3806C91D07F109D6"
s=s+"7527C185683448154D6921610755BEF30B8027E5E8B04E592E8B2EA354A261EABB4851"
s=s+"6472D469A66824F24D44B15CE142FCB65307F21CDABBD6858CC7AE3CEE06AE64BED91A"
s=s+"0412E6F33BA04FAB57B8E52165CA81D0C7D118385D6D230A47E1E8B53AF0D9A7AAC252"
s=s+"7B46C4027841AA385A40C6C517AF8ED268F469990D6DAE2B68F62FDDB6F303A7598BE8"
s=s+"D5B71A3A803712C7E6BB1BCBC0C87BEA5A8EE3E8E1E8E6EBA99C047DB5F6E1372796DC"
s=s+"2634E56552D80C5FBAF826A9C3DC2C19E9969E2765BF881EEA8BF670501F6A39CC95E5"
s=s+"359117F9FEC0ADFB7B959529BD2C7BE5DB65707C4CA4DE869092F0029D9E35246F4953"
s=s+"A7E075E5180868FA5BD60A328B3FEA53084D174C9DE8C8F6A197D66359B69A2292D25F"
s=s+"12F1B322392B1035A8158A10F9560FF1927E269BF2A6E1644A5643CA70B2F661E2A3CA"
s=s+"134E515E81C62D129BA3B6D66CE3BAD95436C15FCE6ECCD52AAD271047DEF55B084335"
s=s+"491F865990C47166611AEDDCDC4B807A11BE084D85B0EFA80BD31F0A021E45802582D1"
s=s+"F605B1AE3E3274AE42535DA274F7FED7C5A3869CCDBCA58C54DD24986A593F18BB8C42"
s=s+"291E7964C993D14CBAC363A801A2048D4E3C6F8ECFA75FCCD009A649AF5EC20C4D7ED7"
s=s+"8437B46B6AAF5B9DB4ADF402CF640530118E9852BE4203F22CBB68DFF2BF38A6EAE0B6"
s=s+"D0E7BBFE4DD397D42401F61419B1F38C038BD24BAD2F3071C2E144721FF72866530E1B"
s=s+"C7F6DC9F6217E2585AC3FF7C8FB1E868233D62DE85E6DF73BFD1C81E4566CE96359502"
s=s+"2C3B9105642F0729439441BCD983EA5F18E1BCCD4ECC56CAB4390DF6155B21BD8AB7C7"
s=s+"2F003621B4D18037ACE446EC120E5214D1862EB05C6BB57DED789B1D981A31B96A33B3"
s=s+"520E76645DCE6C541E0995B7B15AD8008C7D6B9C9095F0563EEFFB01DE6C4FFDA8DBD6"
s=s+"43FD03FF5C5C5D0AFB47E33B41CC9B014DB526CAE4FD5415F572C4E91813274A4A850E"
s=s+"1F633438C15065A3114FEDCDCF2B364E81C158AD6018C2261652077E20C4B16A5E07AC"
s=s+"791297DA1D7F22B93B7BBD5F04BC92A7585DAD273C4CDE7BC7B67B32A3820A79C7875D"
s=s+"14545C6D11F4B0B346FADE8EE9ECD09E8E0DE1BF709E184CA9093701884F767C72167F"
s=s+"E90FC7078439C1BE5794BBCC424DBAAC1F4D03EC1B37C7D136C49A76C05AEEED73BE47"
s=s+"B0870E5A51115D34C5DCB74A8101DF2B5AAFF99E0F073EBF631DA29E5B1F748857C1A7"
s=s+"C1FEAE6214F9EB799520E8F140B6C49C2310674127B6891DE54FD0E45E6941625803D1"
s=s+"26C3950C0DBF72B629A9D2A6EECF4C04F4DEBAC84FFB853B81801B3D9DBD191C0048F3"
s=s+"C10C1B7C035F79E4D62712A999C5C6A6CF47D5C380BB1DF524D9E77FC7BBDFEE3E3E77"
s=s+"AB5E45F632C5FBA13BD57B3CC670FDFA0B0BF64A960492AEAA14BB157FD48992368C9F"
s=s+"D0A2EBF944E0B39614DCBF453AF975CEB3DA507CBB4083082075C900672EF214B05C67"
s=s+"470E38FB3176AE19A5C15FBA6F385693AA0484D9731E4D24B7460692C0E84183A34721"
s=s+"B17C58F3819CDFB1E008EAFCED5F9D53B778DA7161438A5DD84B360F06F0C142A9D0AE"
s=s+"7F151A89DD770625185F59C93758D872A03AD696E08D2FE30D018861D1AC9CC8A67099"
s=s+"7324904BC887323BA95C8DD04B9BE312769A31E71E988A33BD1C8EF024A3983E845DEF"
s=s+"CAF003A6888DDE2623845F586BF4DC88F411757E87280C541D80D100EB446C36FBD4CA"
s=s+"A0DDEF68CAEEABB322865857D9DA5CD880CCA44878A42CB9E51F19FD550BAA29663101"
s=s+"F29D1244CBFB6CC801F3EF566E43F8C6B6FF5F64C3E94C3B759F0251625EF06F8AFF00"
s=s+"48377BCC63832CF8CCEA74158090573B8895499CB0A6D4CC68475B711074A55FD3624A"
s=s+"06B43AAADCC4F36AB4242CCDEF36FE47CC56824E9CB2831EE1E3C9638B8DFFB37A0FD2"
s=s+"984D2E2C33D378A99C0FD0FBF3B64431ADD555BE6E291F9BF753A103556076F66CBA1C"
s=s+"3BCDC5662F639C227D4AD3E5D11C5561B0AB026448199908FC6602829D98B82586B047"
s=s+"903F64959B7EAD3499540B4B671CC6DD4EFAEE48EA5D62B6B0A1B5955141C755F1A046"
s=s+"04D432B2799B4EF46E8452D8884692244416FB6D31A843ACDF4CF7A1EDC0F52DCB8E19"
s=s+"FF2C8F92E4039765E929F8558FD54EE8D1513D5EA7EC1F7E812B7F73387A0774C50BD3"
s=s+"CEDDC511370A18381AE867F84B6F396EEA516454AEBEE4BB00D2FC110C449B8991D63A"
s=s+"DADE954805F089F12EB1477D525B8373B3434C3EB56B7A2F118FDCCC014840DBEE43BE"
s=s+"C9A8A34747DEBA009DE92D569C02CD72C62E71353E4A9098F473AE243294BBF19B5285"
s=s+"94FB9CC7ABBE49ACD3BE823F832EAF8F3E6411D7ED8398FCE78E601E86CF32898A795D"
s=s+"47BF1314821F8A07562109789AFC2317E3DE292CEB8FA7B8A84D6673D8F50BF732406A"
s=s+"7BC53B9D9518F43B47EE848A3DCCAD8F2083CA616190D65A4F2A60F53C0E3A96EE634B"
s=s+"35E1F2CFA6584EC456BEA01B40EF33108A8DF88D99E4874C48982AE83A5946631A0882"
s=s+"8212327AAA4AC181B795DE91FE67F2FBEDED4515D9EAD0BF3DEC28CC1E6EAC60F26CCC"
s=s+"0C1506C61365F8F30325A362DDD2B4550070B7A3BB272CB5B469CFE3A8229C334D6A6C"
s=s+"D702342B37AED7E070F521386F46EC04FA65A4376B6CD9276EBCDD74942F8B73A871FD"
s=s+"0113654A31FB8C366F2B7C77408147DE843B9761050D027222F7AC02A176D16C7F83ED"
s=s+"006AD3ADBBA887B9B06F762DB20196FB276397E207FFA37B465BEEA443A6A10D628A90"
s=s+"CE8CED8AC65DBBD750AC6409F4F0C53E14438EA39E711D48CB330721C80F03D15D7D44"
s=s+"6373DAD4CF3F9217118D549A585E451B39C4E4184DDE85FC6EBE05EAC80E7E348E540A"
s=s+"814468E470F143E2CC5FADF27CF2DDF9E8182480EE509F56813B81D4591810D344DE61"
s=s+"0D5304B848EF275B3B8E161E14138B3A2F72591433AC4F417561474D3FF728463B742D"
s=s+"BA371ACBB292B0275AD5BF8820C19284046677D9AA69EFA79B49024E64BD83E8907CFC"
s=s+"3E44B0D11F74CBE99F9A4927F3EEF78892BF2F7574B0AC02FBA2E7E2AD898E159FE195"
s=s+"08FCFF1DE8B09F3CE55CDAE464B33EAAA1F0E935ED0C5231BE3760303D81CB05A9F22E"
s=s+"83DD61C4170462F62374FC9EBCAEE3BCD1492E2B5D5E6473FC148104860B876D685026"
s=s+"D53D471418C6C942E48CA88E2BADBC52FA2BFF2E70B53FABBCE499BAC7D898C743980E"
s=s+"BD6D3C54E62824DB498A4A55BBC3E1568EB318EACD3F97B8DFCF3146B4135E355101EC"
s=s+"942F21E7AFB1172601EACBD75812DA422A1792A3A44D826CEA9CE202C6A9BF1D2D9D83"
s=s+"8AD4E2AEB8623499771C9AA120E3667F26917212C1B84F08765B2CABCAA898F5E33634"
s=s+"8AF5D4A34FD55F71A89A1B2B0952BBC8B1D1EF86A1634ABF2A3C3A927B831DE4DEF0C5"
s=s+"08B78954A3C46C1B54A4463C301279D2B0E64B178EA9A9CFA557CC39CA93E3FEFCFE06"
s=s+"5BEFD50CA4A2BD39B51B2AC1166124A0718F0C98CDF5E2789C41BA23EE15F98C1157FE"
s=s+"D1627E9A108C43A5AE8BFB4BD1DE3FF57E37143946AED8BB9691B10E757BA7502F8E5E"
s=s+"B370B8EE992EAC1D69555411CD0BB862B5906A8F0AEC52363A80DF018830742FC5A71B"
s=s+"9E95271B3B2B53285BD89B69706DCB4A188BD8444DA663583FDB84E1978F45F2F60670"
s=s+"76ADE78EEA80996FF1094AA9C3F606615ECE2A64A64D1F9077D7CF375559940B03D828"
s=s+"B0337FB9CE82CBC8CCBD15659CA59945B0433ACC9C31CC1A0624E35B0B6BB7757C804B"
s=s+"9FA5292D148629D8B8BAA8C459AAFC68853F128BBAE11911E08C650437EBEA60ECD276"
s=s+"AA74E6595D3CA361FE40251640FC7E834CA85F2D1F9460EADF8E7E92B70E5BA8EE0F49"
s=s+"BBE566AFB8202970FE8492D2A919AB8B5762966B308041A5CA4CF3DB8F63BBF2D803E3"
s=s+"88828A482539E1CC32BF26194CC8E23E6290BCDAC557332469C217169EB7E3D5C47079"
s=s+"A12D9E3C741FFFFA64F22FF609B7C9422A7FEE8D50DD4E60A301267BCC7818218D4735"
s=s+"E858FFD46392A4F04E6DE56D879A23C524DEF0FB8BFED3866DFDCB3673AFF85627B035"
s=s+"856DF8F1C0D44E487C0E3CAA63E9891595CAEC60C5F91354EA76270CABC43FEF6FD45D"
s=s+"A4B6C76B1A21DECF991D6E8D130588BE2BCA6678A7C3A94B385C1E12D91EE40EF8DDED"
s=s+"9A6312E4865002E323D9C1DD06C82C759E81875521AC1AE580C53C1A85EE4495081785"
s=s+"83D4C6BBD63DFAA15E9ADF52AE66AFA6DEF5D9ACF40DA1840C24"

loop.l

strOK.s = "6DB36CB18D3475B9C01DB3C789528080279BBAEFF2B7D558ED6615987C851863F8A6C2CFFBC89C3F75A18D96B127C717D54D0D8048DA8A0544626D17A2A8FBE"
StartTime.l = ElapsedMilliseconds()
mp_init_size(i, 512)
mp_init_size(j, 512)
mp_init_size(k, 512)
mp_init_size(y, 512)
mp_read_radix (i, s , 16)
mp_read_radix (j, strOK, 16)

mp_div (i, j, y, k)
ElapsedTime.l = ElapsedMilliseconds()-StartTime
s=Space(10024)
mp_toradix (y, @s, 16)
MessageRequester("", "ElapsedTime = "+Str(ElapsedTime)+"    "+PeekS(@s,-1,#PB_Ascii))

mp_toradix (k, @s, 16)
MessageRequester("", "remainder = "+PeekS(@s,-1,#PB_Ascii))

mp_read_radix (i, "3333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333", 10)
mp_read_radix (j, "4444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444", 10)
;mp_expt_d (i, 2, y)
mp_mul(i, j, y)
s=Space(10024)
mp_toradix (y, s, 10)
s=PeekS(@s,-1,#PB_Ascii)
MessageRequester("", "length of output string For y = "+Str(Len(s)))
MessageRequester("",Str(y\used)+"         "+ s)

mp_clear(y)
mp_clear(k)
mp_clear(j)
mp_clear(i)
CompilerEndIf


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 1 post ] 

All times are UTC + 1 hour


Who is online

Users browsing this forum: No registered users and 3 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  

 


Powered by phpBB © 2008 phpBB Group
subSilver+ theme by Canver Software, sponsor Sanal Modifiye