Skip to content

Commit

Permalink
EncodeBase58: don't convert little- to big-endian just to undo it
Browse files Browse the repository at this point in the history
  • Loading branch information
roques committed Nov 13, 2012
1 parent f2b1280 commit 8ed9c48
Showing 1 changed file with 2 additions and 7 deletions.
9 changes: 2 additions & 7 deletions src/base58.h
Expand Up @@ -32,14 +32,9 @@ inline std::string EncodeBase58(const unsigned char* pbegin, const unsigned char
CBigNum bn58 = 58;
CBigNum bn0 = 0;

// Convert big endian data to little endian
// Extra zero at the end make sure bignum will interpret as a positive number
std::vector<unsigned char> vchTmp(pend-pbegin+1, 0);
reverse_copy(pbegin, pend, vchTmp.begin());

// Convert little endian data to bignum
// Convert big endian data to bignum
CBigNum bn;
bn.setvch(vchTmp);
BN_bin2bn(pbegin, pend - pbegin, &bn);

// Convert bignum to std::string
std::string str;
Expand Down

0 comments on commit 8ed9c48

Please sign in to comment.