GNet Network Library Reference Manual
<<< Previous Page | Home | Up | Next Page >>>

# sha

## Name

sha --

## Synopsis

    struct      GSHA;
    #define     GNET_SHA_HASH_LENGTH
    GSHA*       gnet_sha_new                    (const guint8 *buffer,
                                                 guint length);
    GSHA*       gnet_sha_new_string             (const gchar *str);
    GSHA*       gnet_sha_clone                  (const GSHA *gsha);
    void        gnet_sha_delete                 (GSHA *gsha);
    GSHA*       gnet_sha_new_incremental        (void);
    void        gnet_sha_update                 (GSHA *gsha,
                                                 const guchar *buffer,
                                                 guint length);
    void        gnet_sha_final                  (GSHA *gsha);
    gint        gnet_sha_equal                  (gconstpointer p1,
                                                 gconstpointer p2);
    guint       gnet_sha_hash                   (gconstpointer p);
    guint8*     gnet_sha_get_digest             (const GSHA *gsha);
    gchar*      gnet_sha_get_string             (const GSHA *gsha);
    void        gnet_sha_copy_string            (const GSHA *gsha,
                                                 guint8 *buffer);

## Description

## Details

### struct GSHA

    struct GSHA;

### GNET_SHA_HASH_LENGTH

    #define     GNET_SHA_HASH_LENGTH

Length of the SHA hash in bytes.

### gnet_sha_new ()

    GSHA*       gnet_sha_new                    (const guint8 *buffer,
                                                 guint length);

Create an SHA hash of the buffer.

`buffer` : |
`length` : |
Returns : |

### gnet_sha_new_string ()

    GSHA*       gnet_sha_new_string             (const gchar *str);

Create an SHA hash from a hexidecimal string. The string must be of length greater than or equal to `GNET_SHA_HASH_LENGTH` * 2.

`str` : |
Returns : |

### gnet_sha_clone ()

    GSHA*       gnet_sha_clone                  (const GSHA *gsha);

Create a SHA from another one.

`gsha` : |
Returns : |

### gnet_sha_delete ()

    void        gnet_sha_delete                 (GSHA *gsha);

Delete a GSHA.

`gsha` : |

### gnet_sha_new_incremental ()

    GSHA*       gnet_sha_new_incremental        (void);

Create a SHA hash in incremental mode. After creating the GSHA, call gnet_sha_update() and gnet_sha_final().

Returns : |

### gnet_sha_update ()

    void        gnet_sha_update                 (GSHA *gsha,
                                                 const guchar *buffer,
                                                 guint length);

Update the hash with buffer. This may be called several times on an incremental hash before being finalized.

`gsha` : |
`buffer` : |
`length` : |

### gnet_sha_final ()

    void        gnet_sha_final                  (GSHA *gsha);

Calcuate the final hash value. This is called on a GSHA created using gnet_sha_new_incremental() and updated using gnet_sha_update() possibly several times.

`gsha` : |

### gnet_sha_equal ()

    gint        gnet_sha_equal                  (gconstpointer p1,
                                                 gconstpointer p2);

Compare two GSHA's.

`p1` : |
`p2` : |
Returns : |

### gnet_sha_hash ()

    guint       gnet_sha_hash                   (gconstpointer p);

Hash the GSHA hash value. This is not the actual SHA hash, but a hash of this hash.

`p` : |
Returns : |

### gnet_sha_get_digest ()

    guint8*     gnet_sha_get_digest             (const GSHA *gsha);

Get the SHA hash digest.

`gsha` : |
Returns : |

### gnet_sha_get_string ()

    gchar*      gnet_sha_get_string             (const GSHA *gsha);

Get a hash string.

`gsha` : |
Returns : |

### gnet_sha_copy_string ()

    void        gnet_sha_copy_string            (const GSHA *gsha,
                                                 guint8 *buffer);

Copy the hash string into the buffer.

`gsha` : |
`buffer` : |

<<< Previous Page | Home | Up | Next Page >>>
md5 | url