Programming with large integers

Click For Summary

Discussion Overview

The discussion revolves around programming with large integers, specifically focusing on libraries and methods for handling very large numbers in various programming environments. Participants explore the requirements for precision in mathematical operations involving large integers, particularly in the context of encryption algorithms and custom implementations.

Discussion Character

  • Technical explanation
  • Debate/contested
  • Homework-related

Main Points Raised

  • One participant inquires about libraries for handling large integers beyond the standard Windows API, expressing a need for precision in mathematical operations.
  • Another participant suggests the GMP library as a commonly used option for big number operations.
  • A beginner expresses difficulty in integrating the GMP library with Turbo C++, seeking guidance on the process.
  • Another participant mentions programming an encryption algorithm that requires handling very large numbers, questioning how to achieve this in Pascal or Visual Basic .NET.
  • One participant notes that cryptography often utilizes libraries like GMP for operations such as exponentiation and multiplication.
  • Another suggestion is made to create a custom integer class to manage N-bit binary numbers, prompting a discussion about storage methods and ease of coding operations.
  • A participant questions whether coding custom operations is the only option available, expressing concerns about performance compared to using assembly instructions.
  • Participants share a link to download the GMP library, indicating its availability for those interested.

Areas of Agreement / Disagreement

There is no consensus on the best approach to handling large integers, with participants discussing various libraries, custom implementations, and programming languages. Multiple competing views remain regarding the integration of libraries and the feasibility of custom solutions.

Contextual Notes

Participants express uncertainty about the integration of libraries in different programming environments and the performance implications of various approaches. The discussion includes references to specific programming languages and libraries, but lacks detailed resolutions on the best practices for implementation.

Who May Find This Useful

Programmers interested in handling large integers, particularly in the context of cryptography or custom mathematical operations, may find this discussion relevant.

finchie_88
Hi all, I'm doing a little programming at the moment using Dev-C++. I'm writing a windows program, and have all of the stuff like menus, dialog boxs etc sorted out, and now need to get onto the programming that makes the program achieve something. In the program I will be dealing with very large numbers (at first about 50 to 75 digit numbers, but I am hoping to extend this to around 150 digits once I have a working prototype). I will be doing mathematics with only integers, and will be doing large exponentials (a^(a very large number)), and modulus functions; however, I need near perfect precision, so no rounding. My questions are:
1. Are there any libaries that I will need (or could use) that are not included in the standard windows API? (this may be a difficult question to answer, since this depends on IDE and updates but try your best anyway).
2. How would I integrate them into my program? (Again a bit vague given that I haven't actually said what my program will do).

Any help would be kind, thank you.
 
Technology news on Phys.org
http://www.swox.com/gmp/ is a commonly used big number library.


It's not relevant here, but Java has built-in big number support -- BigInteger.
 
Last edited by a moderator:
Thank you:smile:
 
I am a beginner in programming and I have no clue as to how to integrate GMP with my turbo C++ ( the manual wasn't very helpful ). Can someone give me a walkthrough please ?
 
Yes it would be nice if anyone can help me on the same subject as well. I'm programming an encryption algorithm that requires working with enormous numbers (hundreds of thousands of digits or at least 500 digits to be practicle and less secure). How do I do that in Pascal or Visual Basic .NET? I need a -MANTISSA- that is that long and not a stupid 12 digit mantissa with a large exponent...

Also since we're on the subject, how the heck do they perform operations on the keys in public key cryptography?
 
Cryptography commonly uses libraries like GMP.. after all, most cryptography needs no more operations than exponentiation (mod some number) and multiplication.

- Warren
 
create your own integer class that handles N-bit binary numbers(easily converted so some N-digit decimal. Eberly has a pretty easy to read Integer class. One of the questions you need to ask is do you want to store the memory as a binary number or as a string of digits. When you decide on that then the operations them selves will be easy to code.
 
And where can I get this GMP?

So coding your own operations is the only way? No 'in-built' method? It would be mega slow that way rather than using assembly instructions.
 
Get it here: http://swox.com/gmp/
 
Last edited by a moderator:

Similar threads

  • · Replies 11 ·
Replies
11
Views
2K
  • · Replies 56 ·
2
Replies
56
Views
10K
Replies
86
Views
3K
  • · Replies 1 ·
Replies
1
Views
4K
Replies
19
Views
4K
  • · Replies 8 ·
Replies
8
Views
2K
  • · Replies 6 ·
Replies
6
Views
2K
  • · Replies 9 ·
Replies
9
Views
2K
Replies
3
Views
2K
  • · Replies 4 ·
Replies
4
Views
5K