/usr/share/gtk-doc/html/gnet/gnet-md5.html is in libgnet-dev 2.0.8-2.2ubuntu1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 | <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
<title>MD5</title>
<meta name="generator" content="DocBook XSL Stylesheets V1.72.0">
<link rel="start" href="index.html" title="GNet Network Library Reference Manual">
<link rel="up" href="libgnet-reference.html" title="GNet Library Reference">
<link rel="prev" href="gnet-pack.html" title="Pack">
<link rel="next" href="gnet-sha.html" title="SHA">
<meta name="generator" content="GTK-Doc V1.8 (XML mode)">
<link rel="stylesheet" href="style.css" type="text/css">
<link rel="chapter" href="gnet-overview.html" title="GNet Overview">
<link rel="chapter" href="gnet-developers.html" title="GNet for developers">
<link rel="chapter" href="gnet-examples.html" title="GNet Examples">
<link rel="chapter" href="libgnet-reference.html" title="GNet Library Reference">
</head>
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
<table class="navigation" id="top" width="100%" summary="Navigation header" cellpadding="2" cellspacing="2">
<tr valign="middle">
<td><a accesskey="p" href="gnet-pack.html"><img src="left.png" width="24" height="24" border="0" alt="Prev"></a></td>
<td><a accesskey="u" href="libgnet-reference.html"><img src="up.png" width="24" height="24" border="0" alt="Up"></a></td>
<td><a accesskey="h" href="index.html"><img src="home.png" width="24" height="24" border="0" alt="Home"></a></td>
<th width="100%" align="center">GNet Network Library Reference Manual</th>
<td><a accesskey="n" href="gnet-sha.html"><img src="right.png" width="24" height="24" border="0" alt="Next"></a></td>
</tr>
<tr><td colspan="5" class="shortcuts"><nobr><a href="#id391036" class="shortcut">Top</a>
 | 
<a href="#id391700" class="shortcut">Description</a></nobr></td></tr>
</table>
<div class="refentry" lang="en">
<a name="gnet-md5"></a><div class="titlepage"></div>
<div class="refnamediv"><table width="100%"><tr>
<td valign="top">
<h2>
<a name="id391036"></a><span class="refentrytitle">MD5</span>
</h2>
<p>MD5 — MD5 hash</p>
</td>
<td valign="top" align="right"></td>
</tr></table></div>
<div class="refsynopsisdiv">
<h2>Synopsis</h2>
<pre class="synopsis">
#include <gnet.h>
<a href="gnet-md5.html#GMD5:CAPS">GMD5</a>;
#define <a href="gnet-md5.html#GNET-MD5-HASH-LENGTH:CAPS">GNET_MD5_HASH_LENGTH</a>
<a href="gnet-md5.html#GMD5:CAPS">GMD5</a>* <a href="gnet-md5.html#gnet-md5-new">gnet_md5_new</a> (const gchar *buffer,
guint length);
<a href="gnet-md5.html#GMD5:CAPS">GMD5</a>* <a href="gnet-md5.html#gnet-md5-new-string">gnet_md5_new_string</a> (const gchar *str);
<a href="gnet-md5.html#GMD5:CAPS">GMD5</a>* <a href="gnet-md5.html#gnet-md5-clone">gnet_md5_clone</a> (const <a href="gnet-md5.html#GMD5:CAPS">GMD5</a> *md5);
void <a href="gnet-md5.html#gnet-md5-delete">gnet_md5_delete</a> (<a href="gnet-md5.html#GMD5:CAPS">GMD5</a> *md5);
<a href="gnet-md5.html#GMD5:CAPS">GMD5</a>* <a href="gnet-md5.html#gnet-md5-new-incremental">gnet_md5_new_incremental</a> (void);
void <a href="gnet-md5.html#gnet-md5-update">gnet_md5_update</a> (<a href="gnet-md5.html#GMD5:CAPS">GMD5</a> *md5,
const gchar *buffer,
guint length);
void <a href="gnet-md5.html#gnet-md5-final">gnet_md5_final</a> (<a href="gnet-md5.html#GMD5:CAPS">GMD5</a> *md5);
gboolean <a href="gnet-md5.html#gnet-md5-equal">gnet_md5_equal</a> (gconstpointer p1,
gconstpointer p2);
guint <a href="gnet-md5.html#gnet-md5-hash">gnet_md5_hash</a> (gconstpointer p);
gchar* <a href="gnet-md5.html#gnet-md5-get-digest">gnet_md5_get_digest</a> (const <a href="gnet-md5.html#GMD5:CAPS">GMD5</a> *md5);
gchar* <a href="gnet-md5.html#gnet-md5-get-string">gnet_md5_get_string</a> (const <a href="gnet-md5.html#GMD5:CAPS">GMD5</a> *md5);
void <a href="gnet-md5.html#gnet-md5-copy-string">gnet_md5_copy_string</a> (const <a href="gnet-md5.html#GMD5:CAPS">GMD5</a> *md5,
gchar *buffer);
</pre>
</div>
<div class="refsect1" lang="en">
<a name="id391700"></a><h2>Description</h2>
<p>
The MD5 module provide support for computing and manipulating MD5
hashes. MD5 is a hash function with a very low probability of
collision. MD5 is considered weaker than SHA.
</p>
<p>
An MD5 can be calculated at one time or incrementally. To create a
MD5 at one time, call <a href="gnet-md5.html#gnet-md5-new"><code class="function">gnet_md5_new()</code></a> with the data. To create a MD5
incrementally, call <a href="gnet-md5.html#gnet-md5-new-incremental"><code class="function">gnet_md5_new_incremental()</code></a> to create the MD5
object, then <a href="gnet-md5.html#gnet-md5-update"><code class="function">gnet_md5_update()</code></a> one or more times with data to hash,
and finally call <a href="gnet-md5.html#gnet-md5-final"><code class="function">gnet_md5_final()</code></a>.
</p>
<p>
To get the digest, or hash value, call <a href="gnet-md5.html#gnet-md5-get-digest"><code class="function">gnet_md5_get_digest()</code></a>. This
returns the raw digest as an array of <a href="gnet-md5.html#GNET-MD5-HASH-LENGTH:CAPS"><code class="literal">GNET_MD5_HASH_LENGTH</code></a> bytes. To
get the digest as a human-readable hexidecimal string, call
<a href="gnet-md5.html#gnet-md5-get-string"><code class="function">gnet_md5_get_string()</code></a> or <a href="gnet-md5.html#gnet-md5-copy-string"><code class="function">gnet_md5_copy_string()</code></a>.
</p>
<p>
</p>
<div class="informalexample"><pre class="programlisting">
gchar buffer[] = "Hello world!";
gchar buffer2[] = "Second line";
GMD5* md5;
gchar* md5_str;
/* Compute an MD5 at one time */
md5 = gnet_md5_new (buffer, strlen(buffer));
md5_str = gnet_md5_get_string (md5);
g_print ("The MD5 of %s is %s\n", buffer, md5_str);
/* Use MD5... */
g_free (md5_str);
gnet_md5_delete (md5);
/* Compute an MD5 incrementally */
md5 = gnet_md5_new_incremental ();
gnet_md5_update (md5, buffer, strlen(buffer));
gnet_md5_update (md5, buffer2, strlen(buffer2));
gnet_md5_final (md5);
/* Use MD5... */
gnet_md5_delete (md5);
</pre></div>
<p>
</p>
</div>
<div class="refsect1" lang="en">
<a name="id391825"></a><h2>Details</h2>
<div class="refsect2" lang="en">
<a name="id391834"></a><h3>
<a name="GMD5:CAPS"></a>GMD5</h3>
<a class="indexterm" name="id391847"></a><pre class="programlisting">typedef struct _GMD5 GMD5;</pre>
<p>
GMD5 is a MD5 hash.</p>
<p>
</p>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id391865"></a><h3>
<a name="GNET-MD5-HASH-LENGTH:CAPS"></a>GNET_MD5_HASH_LENGTH</h3>
<a class="indexterm" name="id391878"></a><pre class="programlisting">#define GNET_MD5_HASH_LENGTH 16
</pre>
<p>
Length of the MD5 hash in bytes.</p>
<p>
</p>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id391896"></a><h3>
<a name="gnet-md5-new"></a>gnet_md5_new ()</h3>
<a class="indexterm" name="id391909"></a><pre class="programlisting"><a href="gnet-md5.html#GMD5:CAPS">GMD5</a>* gnet_md5_new (const gchar *buffer,
guint length);</pre>
<p>
Creates a <a href="gnet-md5.html#GMD5:CAPS"><span class="type">GMD5</span></a> from <em class="parameter"><code>buffer</code></em>.</p>
<p>
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><span class="term"><em class="parameter"><code>buffer</code></em> :</span></td>
<td> buffer to hash
</td>
</tr>
<tr>
<td><span class="term"><em class="parameter"><code>length</code></em> :</span></td>
<td> length of <em class="parameter"><code>buffer</code></em>
</td>
</tr>
<tr>
<td><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td>
<td> a new <a href="gnet-md5.html#GMD5:CAPS"><span class="type">GMD5</span></a>.
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id392016"></a><h3>
<a name="gnet-md5-new-string"></a>gnet_md5_new_string ()</h3>
<a class="indexterm" name="id392029"></a><pre class="programlisting"><a href="gnet-md5.html#GMD5:CAPS">GMD5</a>* gnet_md5_new_string (const gchar *str);</pre>
<p>
Creates a <a href="gnet-md5.html#GMD5:CAPS"><span class="type">GMD5</span></a> from <em class="parameter"><code>str</code></em>. <em class="parameter"><code>str</code></em> is a hexidecimal string
representing the digest.</p>
<p>
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><span class="term"><em class="parameter"><code>str</code></em> :</span></td>
<td> hexidecimal string
</td>
</tr>
<tr>
<td><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td>
<td> a new <a href="gnet-md5.html#GMD5:CAPS"><span class="type">GMD5</span></a>.
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id392116"></a><h3>
<a name="gnet-md5-clone"></a>gnet_md5_clone ()</h3>
<a class="indexterm" name="id392128"></a><pre class="programlisting"><a href="gnet-md5.html#GMD5:CAPS">GMD5</a>* gnet_md5_clone (const <a href="gnet-md5.html#GMD5:CAPS">GMD5</a> *md5);</pre>
<p>
Copies a <a href="gnet-md5.html#GMD5:CAPS"><span class="type">GMD5</span></a>.</p>
<p>
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><span class="term"><em class="parameter"><code>md5</code></em> :</span></td>
<td> a <a href="gnet-md5.html#GMD5:CAPS"><span class="type">GMD5</span></a>
</td>
</tr>
<tr>
<td><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td>
<td> a copy of <em class="parameter"><code>md5</code></em>.
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id392209"></a><h3>
<a name="gnet-md5-delete"></a>gnet_md5_delete ()</h3>
<a class="indexterm" name="id392221"></a><pre class="programlisting">void gnet_md5_delete (<a href="gnet-md5.html#GMD5:CAPS">GMD5</a> *md5);</pre>
<p>
Deletes a <a href="gnet-md5.html#GMD5:CAPS"><span class="type">GMD5</span></a>.</p>
<p>
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody><tr>
<td><span class="term"><em class="parameter"><code>md5</code></em> :</span></td>
<td> a <a href="gnet-md5.html#GMD5:CAPS"><span class="type">GMD5</span></a>
</td>
</tr></tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id392285"></a><h3>
<a name="gnet-md5-new-incremental"></a>gnet_md5_new_incremental ()</h3>
<a class="indexterm" name="id392298"></a><pre class="programlisting"><a href="gnet-md5.html#GMD5:CAPS">GMD5</a>* gnet_md5_new_incremental (void);</pre>
<p>
Creates a <a href="gnet-md5.html#GMD5:CAPS"><span class="type">GMD5</span></a> incrementally. After creating a <a href="gnet-md5.html#GMD5:CAPS"><span class="type">GMD5</span></a>, call
<a href="gnet-md5.html#gnet-md5-update"><code class="function">gnet_md5_update()</code></a> one or more times to hash data. Finally, call
<a href="gnet-md5.html#gnet-md5-final"><code class="function">gnet_md5_final()</code></a> to compute the final hash value.</p>
<p>
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody><tr>
<td><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td>
<td> a new <a href="gnet-md5.html#GMD5:CAPS"><span class="type">GMD5</span></a>.
</td>
</tr></tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id392381"></a><h3>
<a name="gnet-md5-update"></a>gnet_md5_update ()</h3>
<a class="indexterm" name="id392393"></a><pre class="programlisting">void gnet_md5_update (<a href="gnet-md5.html#GMD5:CAPS">GMD5</a> *md5,
const gchar *buffer,
guint length);</pre>
<p>
Updates the hash with <em class="parameter"><code>buffer</code></em>. This may be called several times
on a hash created by <a href="gnet-md5.html#gnet-md5-new-incremental"><code class="function">gnet_md5_new_incremental()</code></a> before being
finalized by calling <a href="gnet-md5.html#gnet-md5-final"><code class="function">gnet_md5_final()</code></a>.</p>
<p>
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><span class="term"><em class="parameter"><code>md5</code></em> :</span></td>
<td> a <a href="gnet-md5.html#GMD5:CAPS"><span class="type">GMD5</span></a>
</td>
</tr>
<tr>
<td><span class="term"><em class="parameter"><code>buffer</code></em> :</span></td>
<td> buffer to add
</td>
</tr>
<tr>
<td><span class="term"><em class="parameter"><code>length</code></em> :</span></td>
<td> length of <em class="parameter"><code>buffer</code></em>
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id392525"></a><h3>
<a name="gnet-md5-final"></a>gnet_md5_final ()</h3>
<a class="indexterm" name="id392537"></a><pre class="programlisting">void gnet_md5_final (<a href="gnet-md5.html#GMD5:CAPS">GMD5</a> *md5);</pre>
<p>
Calcuates the final hash value of a <a href="gnet-md5.html#GMD5:CAPS"><span class="type">GMD5</span></a>. This should only be
called on an <a href="gnet-md5.html#GMD5:CAPS"><span class="type">GMD5</span></a> created by <a href="gnet-md5.html#gnet-md5-new-incremental"><code class="function">gnet_md5_new_incremental()</code></a>.</p>
<p>
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody><tr>
<td><span class="term"><em class="parameter"><code>md5</code></em> :</span></td>
<td> a <a href="gnet-md5.html#GMD5:CAPS"><span class="type">GMD5</span></a>
</td>
</tr></tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id392620"></a><h3>
<a name="gnet-md5-equal"></a>gnet_md5_equal ()</h3>
<a class="indexterm" name="id392632"></a><pre class="programlisting">gboolean gnet_md5_equal (gconstpointer p1,
gconstpointer p2);</pre>
<p>
Compares two <a href="gnet-md5.html#GMD5:CAPS"><span class="type">GMD5</span></a>'s for equality.</p>
<p>
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><span class="term"><em class="parameter"><code>p1</code></em> :</span></td>
<td> first <a href="gnet-md5.html#GMD5:CAPS"><span class="type">GMD5</span></a>.
</td>
</tr>
<tr>
<td><span class="term"><em class="parameter"><code>p2</code></em> :</span></td>
<td> second <a href="gnet-md5.html#GMD5:CAPS"><span class="type">GMD5</span></a>.
</td>
</tr>
<tr>
<td><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td>
<td> TRUE if they are equal; FALSE otherwise.
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id392735"></a><h3>
<a name="gnet-md5-hash"></a>gnet_md5_hash ()</h3>
<a class="indexterm" name="id392748"></a><pre class="programlisting">guint gnet_md5_hash (gconstpointer p);</pre>
<p>
Creates a hash code for a <a href="gnet-md5.html#GMD5:CAPS"><span class="type">GMD5</span></a> for use with GHashTable. This
hash value is not the same as the MD5 digest.</p>
<p>
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><span class="term"><em class="parameter"><code>p</code></em> :</span></td>
<td> a <a href="gnet-md5.html#GMD5:CAPS"><span class="type">GMD5</span></a>
</td>
</tr>
<tr>
<td><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td>
<td> the hash code for <em class="parameter"><code>p</code></em>.
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id392829"></a><h3>
<a name="gnet-md5-get-digest"></a>gnet_md5_get_digest ()</h3>
<a class="indexterm" name="id392841"></a><pre class="programlisting">gchar* gnet_md5_get_digest (const <a href="gnet-md5.html#GMD5:CAPS">GMD5</a> *md5);</pre>
<p>
Gets the raw MD5 digest.</p>
<p>
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><span class="term"><em class="parameter"><code>md5</code></em> :</span></td>
<td> a <a href="gnet-md5.html#GMD5:CAPS"><span class="type">GMD5</span></a>
</td>
</tr>
<tr>
<td><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td>
<td> a callee-owned buffer containing the MD5 hash digest.
The buffer is <a href="gnet-md5.html#GNET-MD5-HASH-LENGTH:CAPS"><code class="literal">GNET_MD5_HASH_LENGTH</code></a> bytes long.
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id392919"></a><h3>
<a name="gnet-md5-get-string"></a>gnet_md5_get_string ()</h3>
<a class="indexterm" name="id392932"></a><pre class="programlisting">gchar* gnet_md5_get_string (const <a href="gnet-md5.html#GMD5:CAPS">GMD5</a> *md5);</pre>
<p>
Gets the digest represented a human-readable string.</p>
<p>
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><span class="term"><em class="parameter"><code>md5</code></em> :</span></td>
<td> a <a href="gnet-md5.html#GMD5:CAPS"><span class="type">GMD5</span></a>
</td>
</tr>
<tr>
<td><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td>
<td> a hexadecimal string representing the digest. The string
is 2 * <a href="gnet-md5.html#GNET-MD5-HASH-LENGTH:CAPS"><code class="literal">GNET_MD5_HASH_LENGTH</code></a> bytes long and NULL terminated. The
string is caller owned.
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id393010"></a><h3>
<a name="gnet-md5-copy-string"></a>gnet_md5_copy_string ()</h3>
<a class="indexterm" name="id393022"></a><pre class="programlisting">void gnet_md5_copy_string (const <a href="gnet-md5.html#GMD5:CAPS">GMD5</a> *md5,
gchar *buffer);</pre>
<p>
Copies the digest, represented as a string, into <em class="parameter"><code>buffer</code></em>. The
string is not NULL terminated.</p>
<p>
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><span class="term"><em class="parameter"><code>md5</code></em> :</span></td>
<td> a <a href="gnet-md5.html#GMD5:CAPS"><span class="type">GMD5</span></a>
</td>
</tr>
<tr>
<td><span class="term"><em class="parameter"><code>buffer</code></em> :</span></td>
<td> buffer at least 2 * <a href="gnet-md5.html#GNET-MD5-HASH-LENGTH:CAPS"><code class="literal">GNET_MD5_HASH_LENGTH</code></a> bytes long
</td>
</tr>
</tbody>
</table></div>
</div>
</div>
</div>
</body>
</html>
|