BigDigits C++ OOP  1.0.1
Classes | Typedefs | Functions
dibigd.hpp File Reference

The C++ OOP interface to the BigDigits library. More...

Classes

class  dibigd::BigDigit
 Class to represent and operate on a BigDigits number. More...
 
class  dibigd::Bvec
 Utilities for a vector of bytes. More...
 

Typedefs

typedef int(* BD_RANDFUNC) (unsigned char *buf, size_t nbytes, const unsigned char *seed, size_t seedlen)
 TYPEDEF for user-defined random byte generator function.
 
typedef uint32_t bdigit_t
 A synonym for a single digit.
 

Functions

std::string dibigd::compile_time ()
 Return time of compilation as a string. More...
 
BigDigit dibigd::from_octets (const std::vector< unsigned char > bv)
 Convert a byte array to an equivalent BigDigit. More...
 
BigDigit dibigd::from_str (std::string s)
 Convert the initial characters of the string s to an equivalent BigDigit. More...
 
int dibigd::version_core ()
 Return BigDigits core version number. More...
 
std::string dibigd::version_interface ()
 Return version number of this C++ interface. More...
 

Detailed Description

The C++ OOP interface to the BigDigits library.

Function Documentation

◆ compile_time()

std::string dibigd::compile_time ( )

Return time of compilation as a string.

Remarks
For example Apr 11 2026 17:55:03

◆ from_octets()

BigDigit dibigd::from_octets ( const std::vector< unsigned char >  bv)

Convert a byte array to an equivalent BigDigit.

Parameters
bvAn array of bytes.
Remarks
The byte array is interpreted in big-endian order: the first byte is the most significant.
std::vector<unsigned char> bv = { 0xde, 0xad, 0xbe, 0xef };
BigDigit b = from_octets(bv);
b.printhex("b="); // b=0xdeadbeef
BigDigit from_octets(const std::vector< unsigned char > bv)
Convert a byte array to an equivalent BigDigit.
See also
BigDigit::to_octets

◆ from_str()

BigDigit dibigd::from_str ( std::string  s)

Convert the initial characters of the string s to an equivalent BigDigit.

Parameters
sA string of digits. A leading 0x or 0X indicates a hexadecimal (base 16) integer with valid characters [0-9a-fA-F], a leading 0b or 0B indicates a binary (base 2) integer with valid characters [01], otherwise it indicates a decimal (base 10) integer with valid characters [0-9].
Returns
A BigDigit value (zero if error).
Remarks
Leading white space characters are skipped.
BigDigit a = from_str("0xdeadbeefcafebabe");
BigDigit b = from_str("16045690984503098046");
BigDigit c = from_str("0b1101111010101101101111101110111111001010111111101011101010111110");
a.printhex("a="); b.printhex("b="); c.printhex("c=");
// a=0xdeadbeefcafebabe
// b=0xdeadbeefcafebabe
// c=0xdeadbeefcafebabe
BigDigit from_str(std::string s)
Convert the initial characters of the string s to an equivalent BigDigit.
[v1.0.1] This function is now redundant. A simple assignment is sufficient.
BigDigit a = "0xdeadbeefcafebabe";
Exceptions
std::invalid_argumentexception if an invalid character is found.

◆ version_core()

int dibigd::version_core ( )

Return BigDigits core version number.

Returns
An integer of the form major*1000 + minor*100 + release*10 + PP_OPTIONS. For example 2710.

◆ version_interface()

std::string dibigd::version_interface ( )

Return version number of this C++ interface.

Returns
Version string, e.g. "1.0.2"
Copyright © 2026 D.I. Management Services Pty Limited ABN 78 083 210 584 Australia. All rights reserved. <https://di-mgt.com.au/bigdigits.html> Generated on Tue May 5 2026 15:15:13 by Doxygen 1.9.1.