aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWladimir J. van der Laan <laanwj@gmail.com>2016-10-03 07:57:28 +0200
committerWladimir J. van der Laan <laanwj@gmail.com>2016-10-03 07:57:41 +0200
commit6f3ef551fa0fd5f40a027844104759855fd0b823 (patch)
tree7fdb409c6030832dcabae50d35572f315e5d8c0a
parent6013c73b3312e11b447ed387426749014716f820 (diff)
parent1c80386bceb216ca5b5da657e03a29f9c779d58b (diff)
downloadbitcoin-6f3ef551fa0fd5f40a027844104759855fd0b823.tar.xz
Merge #8858: rpc: Generate auth cookie in hex instead of base64
1c80386 rpc: Generate auth cookie in hex instead of base64 (Wladimir J. van der Laan)
-rw-r--r--src/rpc/protocol.cpp7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/rpc/protocol.cpp b/src/rpc/protocol.cpp
index f5275062a2..bb885bb5a6 100644
--- a/src/rpc/protocol.cpp
+++ b/src/rpc/protocol.cpp
@@ -77,9 +77,10 @@ boost::filesystem::path GetAuthCookieFile()
bool GenerateAuthCookie(std::string *cookie_out)
{
- unsigned char rand_pwd[32];
- GetRandBytes(rand_pwd, 32);
- std::string cookie = COOKIEAUTH_USER + ":" + EncodeBase64(&rand_pwd[0],32);
+ const size_t COOKIE_SIZE = 32;
+ unsigned char rand_pwd[COOKIE_SIZE];
+ GetRandBytes(rand_pwd, COOKIE_SIZE);
+ std::string cookie = COOKIEAUTH_USER + ":" + HexStr(rand_pwd, rand_pwd+COOKIE_SIZE);
/** the umask determines what permissions are used to create this file -
* these are set to 077 in init.cpp unless overridden with -sysperms.