Recent

Author Topic: Anyone interested in testing a new Big Integer library?  (Read 22451 times)

ad1mt

  • Sr. Member
  • ****
  • Posts: 327
    • Mark Taylor's Home Page
Anyone interested in testing a new Big Integer library?
« on: November 08, 2023, 06:44:44 pm »
I've been working on a new Big Integer library.  Is anyone interested in testing it out?

I've tried to make it...
1  easy to use - minimal changes required to existing code
2  reasonably fast (EDIT: with latest optimisations, is now faster then the FNX library)
3  pure Pascal code, no assembly and no C, so portable and reliable
4  runs on 32 bit CPUs and 64 bit CPUs
5  small footprint, small code size
6  will actually compile straight out of the box with no messing about
7  unlicensed/public domain, I'm happy to give it away free of any restrictions

Why did I make this?  I could not find any Big Integer library that met all the above criteria. The FNX library is very good, but is 64 bit only. EDIT: I've recently been looking at the MRArith library; it's very fast, but is rather difficult to use and requires substantial changes to existing code.

Disadvantages...
1  only whole integers, no support for other number types
2  only has basic arithmetic, logical and formatting operations
3  does not have extensive maths operations
4  does not have dynamically sized variables, only fixed size, but this can be changed at compiled time with a define
5  relies on Delphi mode for implicit operator overloading

I would welcome all criticism & comments, from anyone who has an interest in programming with big integers. I would especially welcome suggestions from speed freaks on how to make the code run faster   :D

Thanks.
« Last Edit: November 20, 2023, 12:41:31 am by ad1mt »

jollytall

  • Sr. Member
  • ****
  • Posts: 376
Re: Anyone interested in testing a new Big Integer library?
« Reply #1 on: November 08, 2023, 07:19:38 pm »
I am. Where can it be found?

Also there is a unit with flexible data length, allowing practically as long integers as much memory you have.
It has a very limited floating point support as well.
It can handle any base from 2 to 16, most of the formatting used out there.

Would be interested to compare the functionality.

Check this: https://github.com/zsoltszakaly/longmathforpascal

dbannon

  • Hero Member
  • *****
  • Posts: 3192
    • tomboy-ng, a rewrite of the classic Tomboy
Re: Anyone interested in testing a new Big Integer library?
« Reply #2 on: November 09, 2023, 12:00:31 am »
7  unlicensed/public domain, I'm happy to give it away free of any restrictions

I love the spirit of that statement but in practice, its a problem. The Linux distributions, for example, will not permit code that does not have an acceptable open license.  If they don't see a license that they recognise and has been declared suitable, they need to refer to the lawyers and we all know what that means.

I stamp my code with The-Clear-BSD-License - its pretty liberal but not completely. See https://opensource.org/licenses/

Just put a file in there called copyright and have the text -

Files: *
Copyright: 2017-2023 Your Name <someone@somewhere.net>
License: The-Clear-BSD-License

EDIT: stating the bleeding obvious, you would change the names to yours ....

You probably could and should stamp that on each file but its enough.

Keep up the good work !

Davo
« Last Edit: November 09, 2023, 03:46:41 am by dbannon »
Lazarus 3, Linux (and reluctantly Win10/11, OSX Monterey)
My Project - https://github.com/tomboy-notes/tomboy-ng and my github - https://github.com/davidbannon

Bart

  • Hero Member
  • *****
  • Posts: 5497
    • Bart en Mariska's Webstek
Re: Anyone interested in testing a new Big Integer library?
« Reply #3 on: November 09, 2023, 10:32:44 am »
Or LGPL v2, so Lazarus/fpc users can use it without any problems for their programs.

Bart

KodeZwerg

  • Hero Member
  • *****
  • Posts: 2269
  • Fifty shades of code.
    • Delphi & FreePascal
Re: Anyone interested in testing a new Big Integer library?
« Reply #4 on: November 09, 2023, 11:07:08 am »
I do often use the Unlicense.
« Last Edit: Tomorrow at 31:76:97 xm by KodeZwerg »

bobihot

  • New Member
  • *
  • Posts: 37
Re: Anyone interested in testing a new Big Integer library?
« Reply #5 on: November 09, 2023, 12:28:08 pm »
Where is this lib?

ad1mt

  • Sr. Member
  • ****
  • Posts: 327
    • Mark Taylor's Home Page
Re: Anyone interested in testing a new Big Integer library?
« Reply #6 on: November 09, 2023, 03:49:18 pm »
I'm just tidying-up the code, and adding a power operator (can't believe I forgot that one!)
I'm also writing some documentation to explain how to configure and use it.
In a few days, once that's done, I'll put it on my web page and Github, and post links here.
Thanks for your interest.

delphius

  • Jr. Member
  • **
  • Posts: 77
Re: Anyone interested in testing a new Big Integer library?
« Reply #7 on: November 09, 2023, 04:20:57 pm »
writing some documentation to explain how to configure and use it.

And, if possible, comparison with the built-in fpc library for working with large numbers. I'm just picking up now, to work with cryptoprimitives. Thanks!
fpmtls - ssl/tls 1.3 implementation in pure pascal
fpmailsend - sending a simple email message
pascal-webui - use web browser as gui and fpc as backend

ad1mt

  • Sr. Member
  • ****
  • Posts: 327
    • Mark Taylor's Home Page
Re: Anyone interested in testing a new Big Integer library?
« Reply #8 on: November 09, 2023, 06:51:34 pm »
...the built-in fpc library for working with large numbers...
Can you tell me where I can find this?
Thanks.

AlexTP

  • Hero Member
  • *****
  • Posts: 2519
    • UVviewsoft
Re: Anyone interested in testing a new Big Integer library?
« Reply #9 on: November 09, 2023, 06:54:37 pm »
@author,
When you are ready, please add your listing to https://wiki.freepascal.org/BigInteger and you may write detailed comparision there.

Bart

  • Hero Member
  • *****
  • Posts: 5497
    • Bart en Mariska's Webstek
Re: Anyone interested in testing a new Big Integer library?
« Reply #10 on: November 09, 2023, 06:54:56 pm »
...the built-in fpc library for working with large numbers...
Can you tell me where I can find this?
Thanks.

AFAIK we don't have one?

Bart

ad1mt

  • Sr. Member
  • ****
  • Posts: 327
    • Mark Taylor's Home Page
Re: Anyone interested in testing a new Big Integer library?
« Reply #11 on: November 09, 2023, 06:57:31 pm »
... to work with cryptoprimitives...
Are you working on cryptocurrency or cryptography?

ad1mt

  • Sr. Member
  • ****
  • Posts: 327
    • Mark Taylor's Home Page
Re: Anyone interested in testing a new Big Integer library?
« Reply #12 on: November 11, 2023, 05:20:34 pm »
I've made the source code available on my web page here...

   https://mark-taylor.me.uk/index.php?page=Software

and on my github page here...

  https://github.com/ad1mt

This should be considered beta development code. There probably will be bugs waiting to be discovered.

You can do whatever you wish with this code, I do not intend to copyright it. I've been advised to specify a license, but I haven't decided which one just yet. This will probably follow later.

All feedback is welcomed, especially criticism.  Thank you for your interest/help.

AlexTP

  • Hero Member
  • *****
  • Posts: 2519
    • UVviewsoft
Re: Anyone interested in testing a new Big Integer library?
« Reply #13 on: November 11, 2023, 05:30:52 pm »
Github page has the .zip file. It is wrong, we need separate .pas/.inc files. Also the separate folder "src" must contain the component, and "demo" folder must contain the testing app (.lps .lpi .lpr).

ad1mt

  • Sr. Member
  • ****
  • Posts: 327
    • Mark Taylor's Home Page
Re: Anyone interested in testing a new Big Integer library?
« Reply #14 on: November 11, 2023, 05:42:49 pm »
Github page has the .zip file. It is wrong, we need separate .pas/.inc files. Also the separate folder "src" must contain the component, and "demo" folder must contain the testing app (.lps .lpi .lpr).
Sorry. I'm new to this, I've not distributed code very often before.
I have uploaded the source files to src and demo folders. I've added a small text file called "Documentation" to the main folder. I hope I've done this correctly.
« Last Edit: November 11, 2023, 06:19:49 pm by ad1mt »

 

TinyPortal © 2005-2018