Changeset 608 in 3DVCSoftware for trunk/source/Lib/libmd5/MD5.h


Ignore:
Timestamp:
1 Sep 2013, 22:47:26 (12 years ago)
Author:
tech
Message:

Merged DEV-2.0-dev0@604.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/source/Lib/libmd5/MD5.h

    r56 r608  
    44 * granted under this license. 
    55 *
    6  * Copyright (c) 2010-2012, ITU/ISO/IEC
     6 * Copyright (c) 2010-2013, ITU/ISO/IEC
    77 * All rights reserved.
    88 *
     
    3737//! \{
    3838
    39 class MD5 {
     39class MD5
     40{
    4041public:
    4142  /**
     
    6869};
    6970
     71
    7072/**
    71  * Produce an ascii(hex) representation of the 128bit digest.
     73 * Produce an ascii(hex) representation of picture digest.
    7274 *
    7375 * Returns: a statically allocated null-terminated string.  DO NOT FREE.
    7476 */
    7577inline const char*
    76 digestToString(unsigned char digest[16])
     78digestToString(const unsigned char digest[3][16], int numChar)
    7779{
    7880  const char* hex = "0123456789abcdef";
    79   static char string[33];
    80   for (int i = 0; i < 16; i++)
     81  static char string[99];
     82  int cnt=0;
     83  for(int yuvIdx=0; yuvIdx<3; yuvIdx++)
    8184  {
    82     string[i*2+0] = hex[digest[i] >> 4];
    83     string[i*2+1] = hex[digest[i] & 0xf];
     85    for (int i = 0; i < numChar; i++)
     86    {
     87      string[cnt++] = hex[digest[yuvIdx][i] >> 4];
     88      string[cnt++] = hex[digest[yuvIdx][i] & 0xf];
     89    }
     90    string[cnt++] = ',';
    8491  }
     92
     93  string[cnt-1] = '\0';
    8594  return string;
    8695}
Note: See TracChangeset for help on using the changeset viewer.