TheAlgorithms/C++ 1.0.0
All the algorithms implemented in C++
Loading...
Searching...
No Matches
uint256_t.hpp File Reference
#include <string>
#include <utility>
#include "uint128_t.hpp"
Include dependency graph for uint256_t.hpp:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  uint256_t
 class for 256-bit unsigned integer More...

Macros

#define CIPHERS_UINT256_T_HPP_
 for std::pair library

Functions

template<typename T, typename = typename std::enable_if< std::is_integral<T>::value, T>::type>
uint256_t operator+ (const T p, const uint256_t &q)
template<typename T, typename = typename std::enable_if< std::is_integral<T>::value, T>::type>
uint256_t operator- (const T p, const uint256_t &q)
template<typename T, typename = typename std::enable_if< std::is_integral<T>::value, T>::type>
uint256_t operator* (const T p, const uint256_t &q)
template<typename T, typename = typename std::enable_if< std::is_integral<T>::value, T>::type>
uint256_t operator/ (const T p, const uint256_t &q)
template<typename T, typename = typename std::enable_if< std::is_integral<T>::value, T>::type>
uint256_t operator% (const T p, const uint256_t &q)
template<typename T, typename = typename std::enable_if< std::is_integral<T>::value, T>::type>
uint256_t operator& (const T &p, const uint256_t &q)
template<typename T, typename = typename std::enable_if< std::is_integral<T>::value, T>::type>
uint256_t operator| (const T p, const uint256_t &q)
template<typename T, typename = typename std::enable_if< std::is_integral<T>::value, T>::type>
uint256_t operator^ (const T p, const uint256_t &q)
template<typename T, typename = typename std::enable_if< std::is_integral<T>::value, T>::type>
bool operator&& (const T p, const uint256_t &q)
template<typename T, typename = typename std::enable_if< std::is_integral<T>::value, T>::type>
bool operator|| (const T p, const uint256_t &q)
template<typename T, typename = typename std::enable_if< std::is_integral<T>::value, T>::type>
bool operator== (const T p, const uint256_t &q)
template<typename T, typename = typename std::enable_if< std::is_integral<T>::value, T>::type>
bool operator!= (const T p, const uint256_t &q)
template<typename T, typename = typename std::enable_if< std::is_integral<T>::value, T>::type>
bool operator< (const T p, const uint256_t &q)
template<typename T, typename = typename std::enable_if< std::is_integral<T>::value, T>::type>
bool operator<= (const T p, const uint256_t &q)
template<typename T, typename = typename std::enable_if< std::is_integral<T>::value, T>::type>
bool operator> (const T p, const uint256_t &q)
template<typename T, typename = typename std::enable_if< std::is_integral<T>::value, T>::type>
bool operator>= (const T p, const uint256_t &q)

Detailed Description

Implementation of 256-bit unsigned integers.

Note
The implementation can be flagged as not completed. This header is used with enough operations to demonstrate the usage of ECDH (Elliptic Curve Diffie-Hellman) Key exchange.
Author
Ashish Daulatabad

Definition in file uint256_t.hpp.

Macro Definition Documentation

◆ CIPHERS_UINT256_T_HPP_

#define CIPHERS_UINT256_T_HPP_

for std::pair library

for std::string for uint128_t integer

Definition at line 16 of file uint256_t.hpp.

Function Documentation

◆ operator!=()

template<typename T, typename = typename std::enable_if< std::is_integral<T>::value, T>::type>
bool operator!= ( const T p,
const uint256_t & q )
inline

Definition at line 1037 of file uint256_t.hpp.

1037 {
1038 return uint256_t(p) != q;
1039}
class for 256-bit unsigned integer
Definition uint256_t.hpp:24

◆ operator%()

template<typename T, typename = typename std::enable_if< std::is_integral<T>::value, T>::type>
uint256_t operator% ( const T p,
const uint256_t & q )
inline

Definition at line 992 of file uint256_t.hpp.

992 {
993 return uint256_t(p) % q;
994}

◆ operator&()

template<typename T, typename = typename std::enable_if< std::is_integral<T>::value, T>::type>
uint256_t operator& ( const T & p,
const uint256_t & q )
inline

Definition at line 999 of file uint256_t.hpp.

999 {
1000 return uint256_t(p) & q;
1001}

◆ operator&&()

template<typename T, typename = typename std::enable_if< std::is_integral<T>::value, T>::type>
bool operator&& ( const T p,
const uint256_t & q )
inline

Definition at line 1018 of file uint256_t.hpp.

1018 {
1019 return uint256_t(p) && q;
1020}

◆ operator*()

template<typename T, typename = typename std::enable_if< std::is_integral<T>::value, T>::type>
uint256_t operator* ( const T p,
const uint256_t & q )
inline

Definition at line 980 of file uint256_t.hpp.

980 {
981 return uint256_t(p) * q;
982}

◆ operator+()

template<typename T, typename = typename std::enable_if< std::is_integral<T>::value, T>::type>
uint256_t operator+ ( const T p,
const uint256_t & q )
inline

Definition at line 968 of file uint256_t.hpp.

968 {
969 return uint256_t(p) + q;
970}

◆ operator-()

template<typename T, typename = typename std::enable_if< std::is_integral<T>::value, T>::type>
uint256_t operator- ( const T p,
const uint256_t & q )
inline

Definition at line 974 of file uint256_t.hpp.

974 {
975 return (uint256_t(p) - q);
976}

◆ operator/()

template<typename T, typename = typename std::enable_if< std::is_integral<T>::value, T>::type>
uint256_t operator/ ( const T p,
const uint256_t & q )
inline

Definition at line 986 of file uint256_t.hpp.

986 {
987 return uint256_t(p) / q;
988}

◆ operator<()

template<typename T, typename = typename std::enable_if< std::is_integral<T>::value, T>::type>
bool operator< ( const T p,
const uint256_t & q )
inline

Definition at line 1043 of file uint256_t.hpp.

1043 {
1044 return uint256_t(p) < q;
1045}

◆ operator<=()

template<typename T, typename = typename std::enable_if< std::is_integral<T>::value, T>::type>
bool operator<= ( const T p,
const uint256_t & q )
inline

Definition at line 1049 of file uint256_t.hpp.

1049 {
1050 return uint256_t(p) <= q;
1051}

◆ operator==()

template<typename T, typename = typename std::enable_if< std::is_integral<T>::value, T>::type>
bool operator== ( const T p,
const uint256_t & q )
inline

Definition at line 1031 of file uint256_t.hpp.

1031 {
1032 return uint256_t(p) == q;
1033}

◆ operator>()

template<typename T, typename = typename std::enable_if< std::is_integral<T>::value, T>::type>
bool operator> ( const T p,
const uint256_t & q )
inline

Definition at line 1055 of file uint256_t.hpp.

1055 {
1056 return uint256_t(p) > q;
1057}

◆ operator>=()

template<typename T, typename = typename std::enable_if< std::is_integral<T>::value, T>::type>
bool operator>= ( const T p,
const uint256_t & q )
inline

Definition at line 1061 of file uint256_t.hpp.

1061 {
1062 return uint256_t(p) >= q;
1063}

◆ operator^()

template<typename T, typename = typename std::enable_if< std::is_integral<T>::value, T>::type>
uint256_t operator^ ( const T p,
const uint256_t & q )
inline

Definition at line 1011 of file uint256_t.hpp.

1011 {
1012 return uint256_t(p) ^ q;
1013}

◆ operator|()

template<typename T, typename = typename std::enable_if< std::is_integral<T>::value, T>::type>
uint256_t operator| ( const T p,
const uint256_t & q )
inline

Definition at line 1005 of file uint256_t.hpp.

1005 {
1006 return uint256_t(p) | q;
1007}

◆ operator||()

template<typename T, typename = typename std::enable_if< std::is_integral<T>::value, T>::type>
bool operator|| ( const T p,
const uint256_t & q )
inline

Definition at line 1024 of file uint256_t.hpp.

1024 {
1025 return uint256_t(p) || q;
1026}