So, How can i assign std::string through a function?
i have this code
void WP_Hash(std::string dest, std::string src) { // Set up all the locals struct NESSIEstruct whirlpool_ctx; char digest[64], buffer[4100]; unsigned char *tmp = (unsigned char *)digest; // Start the hashing NESSIEinit(&whirlpool_ctx); NESSIEadd((const unsigned char *)src.c_str(), src.length() * 8, &whirlpool_ctx); // Finish the hashing NESSIEfinalize(&whirlpool_ctx, tmp); // Convert to a real string unsigned int len = 0; while (len< 128) { buffer[len++] = gch[*tmp >> 4]; buffer[len++] = gch[*tmp & 0x0F]; tmp++; } buffer[128] = 0; dest.assign(buffer); } and this code to initialize it:
std::string ret; WP_Hash(ret, "none"); sampgdk::logprintf("%s", ret.c_str()); It print nothing
when i change ret string to "a", it print "a" i want it print none (hashed in WP_Hash but ignore about it, let's say that "none" is the result of WP_Hash)
what could i do?