note 17846 deleted from function.session-id by jimw
| From: | jimw@php.net | Date: | Wed, 02 Jan 2002 11:37:22 +0000 |
| Subject: | note 17846 deleted from function.session-id by jimw | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-24229@lists.php.net to get a copy of this message | ||
The last piece that you mentioned
for (i = 0; i < 16; i++)
sprintf(buf + (i << 1), "%02x", digest[i]);
buf[i << 1] = '\0';
causes it to step through the digest array and enter the value of each element into the buffer (buf)
as follows (%02x):
0 indicates that the value should be left padded with zeros,
2 indicates that the value should be displayed with 2 places (columns),
x indicates that the value should be formated in Hex rather than decimal.
This is for storage purposed with C. C stores each character in its own memory location. So as the
for loop runs it stores the values in a Hex format 2 "characters" long with a leading
zero.
The final piece \0 is a null value which must terminate all C "strings".