Conver char-Array to MD5-Hash


hello,

i´m trying convert char array md5 hash arduino mega libary: https://github.com/tzikis/arduinomd5

here's source:

code: [select]


#include <md5.h>


  char test1[6]={'1','2','3','4','5','7'};
  char *test2="123457";
  byte zaehler;



void setup()
{
  //initialize serial
  serial.begin(9600);
  //give second
  delay(1000);
 
 
 

  //generate md5 hash our string
  unsigned char* hash=md5::make_hash(test);
  //generate digest (hex encoding) of our hash
  char *md5str = md5::make_digest(hash, 16);
  free(hash);
  //print on our serial monitor
  serial.println(md5str);
  //give memory system if run md5 hash generation in loop
  free(md5str);
  serial.println(md5str);

}

void loop()
{
  serial.println(test);
   
}



the problem is, if use array test1 in hash funktion hash result not same hashed test2 variable. why?

maybe because test1 has no terminator?

code: [select]
  char test1[7]={'1','2','3','4','5','7',0};



Arduino Forum > Using Arduino > Networking, Protocols, and Devices (Moderator: fabioc84) > Conver char-Array to MD5-Hash


arduino

Comments

Popular posts from this blog

invalid use of void expresion in FlexiTimer2 library

error: a function-definition is not allowed here before '{' token

LED Strip Code