Browse CVS Repository
Diff of /xoonips/AL/common.cc
Parent Directory
| Revision Log
| Revision Graph
| Patch
| 3 |
* |
* |
| 4 |
* $Revision$ |
* $Revision$ |
| 5 |
* $Log$ |
* $Log$ |
| 6 |
|
* Revision 1.5 2005/01/22 05:38:03 youi |
| 7 |
|
* md5strを定義した. |
| 8 |
|
* |
| 9 |
* Revision 1.4 2005/01/06 07:17:15 youi |
* Revision 1.4 2005/01/06 07:17:15 youi |
| 10 |
* VC toolkit使用時のsnprintfと_fltusedの定義を追加. |
* VC toolkit使用時のsnprintfと_fltusedの定義を追加. |
| 11 |
* |
* |
| 33 |
|
|
| 34 |
/** |
/** |
| 35 |
* |
* |
| 36 |
|
* dataのMD5ハッシュ値を求め,文字列に変換し,指定された文字列バッファ |
| 37 |
|
* strに書き込む. |
| 38 |
|
* |
| 39 |
|
* |
| 40 |
|
* |
| 41 |
|
*/ |
| 42 |
|
char* md5str( char str[MD5_DIGEST_STRING_LENGTH], unsigned char* data, int len ) |
| 43 |
|
{ |
| 44 |
|
MD5_CTX c; |
| 45 |
|
unsigned char buf[MD5_DIGEST_LENGTH]; |
| 46 |
|
static const char hexdigit[]="0123456789abcdef"; |
| 47 |
|
|
| 48 |
|
MD5_Init( &c ); |
| 49 |
|
MD5_Update( &c, data, len ); |
| 50 |
|
MD5_Final( buf, &c ); |
| 51 |
|
|
| 52 |
|
for( int i = 0 ; i < MD5_DIGEST_LENGTH ; i++ ){ |
| 53 |
|
str[i*2] = hexdigit[buf[i]>>4]; |
| 54 |
|
str[i*2+1] = hexdigit[buf[i] & 0x0f]; |
| 55 |
|
} |
| 56 |
|
str[MD5_DIGEST_LENGTH*2] = '\0'; |
| 57 |
|
return str; |
| 58 |
|
} |
| 59 |
|
|
| 60 |
|
/** |
| 61 |
|
* |
| 62 |
* 与えられた文字列を複製し,そのアドレスを返す. |
* 与えられた文字列を複製し,そのアドレスを返す. |
| 63 |
* |
* |
| 64 |
* @param text |
* @param text |
|
|
Legend:
| Removed from v.1.4 |
|
| changed lines |
| |
Added in v.1.5 |
|
|
|