From b7987e257cbca96b1588a23eb2ba5c064d647ada Mon Sep 17 00:00:00 2001 From: Spencer Lievens Date: Wed, 3 May 2017 11:20:01 +0200 Subject: [PATCH] Generate auth cookie in hex instead of base64 --- src/rpcprotocol.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/rpcprotocol.cpp b/src/rpcprotocol.cpp index 8a45c062dd41..d67594f72808 100644 --- a/src/rpcprotocol.cpp +++ b/src/rpcprotocol.cpp @@ -78,9 +78,11 @@ 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.