createrepo_c library 1.2.1 C library for metadata manipulation

Typedefs | Enumerations | Functions
API for checksum calculation.

## Typedefs
typedef struct _cr_ChecksumCtx | cr_ChecksumCtx

## Enumerations
enum | cr_ChecksumType { CR_CHECKSUM_UNKNOWN = 0, CR_CHECKSUM_SHA224 = 4, CR_CHECKSUM_SHA256 = 5, CR_CHECKSUM_SHA384 = 6, CR_CHECKSUM_SHA512 = 7, CR_CHECKSUM_SENTINEL = 8 }

## Functions
const char * | cr_checksum_name_str (cr_ChecksumType type)
cr_ChecksumType | cr_checksum_type (const char *name)
char * | cr_checksum_file (const char *filename, cr_ChecksumType type, GError **err)
cr_ChecksumCtx * | cr_checksum_new (cr_ChecksumType type, GError **err)
int | cr_checksum_update (cr_ChecksumCtx *ctx, const void *buf, size_t len, GError **err)
char * | cr_checksum_final (cr_ChecksumCtx *ctx, GError **err)

## Detailed Description

## Typedef Documentation

## ◆ cr_ChecksumCtx

typedef struct _cr_ChecksumCtx cr_ChecksumCtx

Checksum context.

Definition at line 36 of file checksum.h.

## Enumeration Type Documentation

## ◆ cr_ChecksumType

enum cr_ChecksumType

Enum of supported checksum types. Note: SHA is just a "nickname" for the SHA1. This is for the compatibility with original createrepo.

Enumerator
CR_CHECKSUM_UNKNOWN | Unknown checksum
CR_CHECKSUM_SHA224 | SHA224 checksum
CR_CHECKSUM_SHA256 | SHA256 checksum
CR_CHECKSUM_SHA384 | SHA384 checksum
CR_CHECKSUM_SHA512 | SHA512 checksum
CR_CHECKSUM_SENTINEL | sentinel of the list

Definition at line 43 of file checksum.h.

## Function Documentation

## ◆ cr_checksum_file()

char* cr_checksum_file | ( | const char * | filename,
|  | cr_ChecksumType | type,
|  | GError ** | err
| ) |  |

Compute file checksum.

Parameters

  filename | filename
  type | type of checksum
  err | GError **

Returns
  malloced null terminated string with checksum or NULL on error

## ◆ cr_checksum_final()

char* cr_checksum_final | ( | cr_ChecksumCtx * | ctx,
|  | GError ** | err
| ) |  |

Finalize checksum calculation, return checksum string and frees all checksum context resources.

Parameters

  ctx | Checksum context.
  err | GError **

Returns
  Checksum string or NULL on error.

## ◆ cr_checksum_name_str()

const char* cr_checksum_name_str | ( | cr_ChecksumType | type | ) |

Return checksum name.

Parameters

  type | checksum type

Returns
  constant null terminated string with checksum name or NULL on error

## ◆ cr_checksum_new()

cr_ChecksumCtx* cr_checksum_new | ( | cr_ChecksumType | type,
|  | GError ** | err
| ) |  |

Create new checksum context.

Parameters

  type | Checksum algorithm of the new checksum context.
  err | GError **

Returns
  cr_ChecksumCtx or NULL on error

## ◆ cr_checksum_type()

cr_ChecksumType cr_checksum_type | ( | const char * | name | ) |

Return checksum type.

Parameters

  name | checksum name

Returns
  checksum type

## ◆ cr_checksum_update()

int cr_checksum_update | ( | cr_ChecksumCtx * | ctx,
|  | const void * | buf,
|  | size_t | len,
|  | GError ** | err
| ) |  |

Feeds data into the checksum.

Parameters

  ctx | Checksum context.
  buf | Pointer to the data.
  len | Length of the data.
  err | GError **

Returns
  cr_Error code.