mirror of
https://github.com/Xahau/xahaud.git
synced 2025-12-06 17:27:52 +00:00
Create uint160extend256.
This commit is contained in:
@@ -709,6 +709,7 @@ inline const uint256 operator|(const uint256& a, const uint256& b) { return (b
|
||||
inline const uint256 operator+(const uint256& a, const uint256& b) { return (base_uint256)a + (base_uint256)b; }
|
||||
inline const uint256 operator-(const uint256& a, const uint256& b) { return (base_uint256)a - (base_uint256)b; }
|
||||
|
||||
uint256 uint160extend256(const uint160& uSource);
|
||||
|
||||
inline int Testuint256AdHoc(std::vector<std::string> vArg)
|
||||
{
|
||||
|
||||
@@ -1,4 +1,19 @@
|
||||
#include "utils.h"
|
||||
#include "uint256.h"
|
||||
|
||||
uint256 uint160extend256(const uint160& uSource)
|
||||
{
|
||||
uint256 uResult;
|
||||
|
||||
memcpy(uResult.begin() + (uResult.size() - uSource.size()), uSource.begin(), uSource.size());
|
||||
|
||||
return uResult;
|
||||
}
|
||||
|
||||
//
|
||||
// Time support
|
||||
// We have our own epoch.
|
||||
//
|
||||
|
||||
boost::posix_time::ptime ptEpoch()
|
||||
{
|
||||
@@ -19,6 +34,10 @@ boost::posix_time::ptime ptFromSeconds(int iSeconds)
|
||||
: ptEpoch() + boost::posix_time::seconds(iSeconds);
|
||||
}
|
||||
|
||||
//
|
||||
// Hex suport
|
||||
//
|
||||
|
||||
char charHex(int iDigit)
|
||||
{
|
||||
return iDigit < 10 ? '0' + iDigit : 'A' - 10 + iDigit;
|
||||
@@ -45,6 +64,10 @@ void strUnHex(std::string& strDst, const std::string& strSrc)
|
||||
strDst[i] = (charUnHex(strSrc[i*2]) << 4) | charUnHex(strSrc[i*2+1]);
|
||||
}
|
||||
|
||||
//
|
||||
// DH support
|
||||
//
|
||||
|
||||
void DH_der_gen(std::string& strDer, int iKeyLength)
|
||||
{
|
||||
DH* dh = 0;
|
||||
|
||||
Reference in New Issue
Block a user