Just FYI - following code causes segmentation fault when compiled with o2/max speed optimization for C64+ target.

#define hex_digits "0123456789abcdef"
//const char *hex_digits = "0123456789abcdef"; // no error with this definition

void digest2str(const unsigned char digest[], char *output)
{
  int i;
  for (i = 0; i<16; ++i) {
  unsigned int value = digest[i];
  *output++ = ((const char *)hex_digits)[ (value & 0xF0) >> 4 ];
  *output++ = ((const char *)hex_digits)[ (value & 0x0F) ];
  }
}