Git Product home page Git Product logo

bigintegercpp's Introduction

BigIntegerCPP

BigIntegerCPP is a C++11 port of large integer library used in CryptoLib4Pascal. It allows mostly parsing of numbers as strings in different bases (2, 8, 10 & 16) and converting them back to string, also in different base as stated above. The advantages of this library is its simplistic nature and cleanliness of code.

Code Example

Here is a sample of code which uses BigIntergerCPP to calc 2^20.

#include <iostream>
#include "Base/BigInteger.h"

using namespae std;

int main()
{
    BigInteger::Boot();
    
    BigInteger two("2");
    BigInteger result = two.Pow(20);
    cout << result.ToString(2) << endl; // output string in Base 2

    return 0;
} // end main

Note: Some other functions you might like

  RabinMillerTest
  IsProbablePrime
  ModInverse (Modular Inverse)
  ModPow (Modular Exponentiation)
  NextProbablePrime
  Negate
  TestBit
  GetLowestSetBit
  SetBit
  ClearBit
  FlipBit
  GCD (Greatest Common Divisor (HCF)) 
  Square 
  AbsoluteValue (Get Absolute Value of a Negative BigInteger)
  Random (PcgRandom)

Tested Enviroments:

Visual Studio 2015.

Unittests:

You can find all the unit tests in the Unittest folder. To run the unit tests, you should have boost library installed in your workstation.

Special Note:

You may have noticed that this library needs to Boot firstly before you can begin to use it else it will crash. So, I wrote a wrapper around the BigInteger library called BigIntegerWrapper for those who feel they might forget to Boot the library before using it.

License

This "Software" is Licensed Under MIT License (MIT) .

Tip Jar

  • ๐Ÿ’ต Bitcoin: 1Mcci95WffSJnV6PsYG7KD1af1gDfUvLe6

Conclusion

Special thanks to Xor-el for making this library available in the first place.

bigintegercpp's People

Contributors

lucascampos avatar ron4fun avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.