From: Derek W. <der...@gm...> - 2010-09-30 13:27:20
|
Hello all, I'm attempting to write a very small program that utilizes the bacula hmac and bin_to_base64 functions so I can auth to my director as a console. It seems that my output is slightly different than what the director computes for a base64 hash, example: Director expects: p6+IvREdwWdjZ8kPkQ+cUC But the program I wrote gives: p6+IvREdwWdjZ8kPkQ+cU Where does this last letter come from and how come its missing off the end of my base64 hash. Here is my program code: #include "bacula.h" char* chal; char* password; uint8_t hmac[20]; char base64[23]; uint8_t i; int main(int argc, char *argv[]) { chal = argv[1]; password = argv[2]; hmac_md5((uint8_t *)chal, 50, (uint8_t *)password, strlen(password), hmac); bin_to_base64(base64, sizeof(base64), (char *)hmac, 16, false) + 1; printf("%s\n", base64); } |