Add CashAddr Address Format

Ported from Bitcoin Unlimited, Bitcoin ABC
This commit is contained in:
lateminer
2018-01-14 22:32:08 +03:00
parent 7cd5894690
commit 323a6750c2
85 changed files with 3107 additions and 780 deletions

View File

@@ -93,7 +93,7 @@ static void RandAddSeedPerfmon()
}
/** Get 32 bytes of system entropy. */
static void GetOSRand(unsigned char *ent32)
void GetOSRand(unsigned char *ent32)
{
#ifdef WIN32
HCRYPTPROV hProvider;
@@ -197,3 +197,26 @@ void seed_insecure_rand(bool fDeterministic)
insecure_rand_Rw = tmp;
}
}
FastRandomContext::FastRandomContext(bool fDeterministic)
{
// The seed values have some unlikely fixed points which we avoid.
if (fDeterministic)
{
Rz = Rw = 11;
}
else
{
uint32_t tmp;
do
{
GetRandBytes((unsigned char *)&tmp, 4);
} while (tmp == 0 || tmp == 0x9068ffffU);
Rz = tmp;
do
{
GetRandBytes((unsigned char *)&tmp, 4);
} while (tmp == 0 || tmp == 0x464fffffU);
Rw = tmp;
}
}