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

struct  std::is_integral< uint256_t >
 
struct  std::is_arithmetic< uint256_t >
 
struct  std::is_unsigned< uint256_t >
 
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 1046 of file uint256_t.hpp.

1046 {
1047 return uint256_t(p) != q;
1048}
class for 256-bit unsigned integer
Definition uint256_t.hpp:33

◆ 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 1001 of file uint256_t.hpp.

1001 {
1002 return uint256_t(p) % q;
1003}

◆ 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 1008 of file uint256_t.hpp.

1008 {
1009 return uint256_t(p) & q;
1010}

◆ 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 1027 of file uint256_t.hpp.

1027 {
1028 return uint256_t(p) && q;
1029}

◆ 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 989 of file uint256_t.hpp.

989 {
990 return uint256_t(p) * q;
991}

◆ 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 977 of file uint256_t.hpp.

977 {
978 return uint256_t(p) + q;
979}

◆ 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 983 of file uint256_t.hpp.

983 {
984 return (uint256_t(p) - q);
985}

◆ 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 995 of file uint256_t.hpp.

995 {
996 return uint256_t(p) / q;
997}

◆ 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 1052 of file uint256_t.hpp.

1052 {
1053 return uint256_t(p) < q;
1054}

◆ 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 1058 of file uint256_t.hpp.

1058 {
1059 return uint256_t(p) <= q;
1060}

◆ 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 1040 of file uint256_t.hpp.

1040 {
1041 return uint256_t(p) == q;
1042}

◆ 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 1064 of file uint256_t.hpp.

1064 {
1065 return uint256_t(p) > q;
1066}

◆ 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 1070 of file uint256_t.hpp.

1070 {
1071 return uint256_t(p) >= q;
1072}

◆ 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 1020 of file uint256_t.hpp.

1020 {
1021 return uint256_t(p) ^ q;
1022}

◆ 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 1014 of file uint256_t.hpp.

1014 {
1015 return uint256_t(p) | q;
1016}

◆ 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 1033 of file uint256_t.hpp.

1033 {
1034 return uint256_t(p) || q;
1035}