mdigest.h File Reference
`#include <gwenhywfar/list1.h>`
`#include <gwenhywfar/list2.h>`
`#include <gwenhywfar/hashalgo.h>`
`#include <gwenhywfar/stringlist.h>`

Go to the source code of this file.

## Typedefs

typedef struct GWEN_MDIGEST | GWEN_MDIGEST

## Functions

GWENHYWFAR_API int | GWEN_MDigest_Begin (GWEN_MDIGEST *md)
GWENHYWFAR_API int | GWEN_MDigest_CheckFileTree (GWEN_MDIGEST *md, const char *folder, const char *checksumFile, int strictCheck, uint32_t pid)
GWENHYWFAR_API int | GWEN_MDigest_Digest (GWEN_MDIGEST *md, const uint8_t *srcBuf, unsigned int srcLen, uint8_t *dstBuf, unsigned int dstLen)
GWENHYWFAR_API int | GWEN_MDigest_End (GWEN_MDIGEST *md)
GWENHYWFAR_API void | GWEN_MDigest_free (GWEN_MDIGEST *md)
GWENHYWFAR_API uint8_t * | GWEN_MDigest_GetDigestPtr (GWEN_MDIGEST *md)
GWENHYWFAR_API unsigned int | GWEN_MDigest_GetDigestSize (GWEN_MDIGEST *md)
GWENHYWFAR_API GWEN_CRYPT_HASHALGOID | GWEN_MDigest_GetHashAlgoId (const GWEN_MDIGEST *md)
GWENHYWFAR_API int | GWEN_MDigest_HashFileTree (GWEN_MDIGEST *md, const char *folder, const char *ignoreFile, GWEN_STRINGLIST *sl)
GWENHYWFAR_API GWEN_MDIGEST * | GWEN_MDigest_Md5_new (void)
GWENHYWFAR_API int | GWEN_MDigest_PBKDF2 (GWEN_MDIGEST *md, const char *password, const uint8_t *pSalt, uint32_t lSalt, uint8_t *pKey, uint32_t lKey, uint32_t iterations)
GWENHYWFAR_API GWEN_MDIGEST * | GWEN_MDigest_Rmd160_new (void)
GWENHYWFAR_API GWEN_MDIGEST * | GWEN_MDigest_Sha1_new (void)
GWENHYWFAR_API GWEN_MDIGEST * | GWEN_MDigest_Sha256_new (void)
GWENHYWFAR_API int | GWEN_MDigest_Update (GWEN_MDIGEST *md, const uint8_t *buf, unsigned int l)

## Typedef Documentation

## GWEN_MDIGEST

typedef struct GWEN_MDIGEST GWEN_MDIGEST

Definition at line 25 of file mdigest.h.

## Function Documentation

## GWEN_MDigest_Begin()

GWENHYWFAR_API int GWEN_MDigest_Begin | ( | GWEN_MDIGEST * | md | ) |

References GWENHYWFAR_API.

## GWEN_MDigest_CheckFileTree()

GWENHYWFAR_API int GWEN_MDigest_CheckFileTree | ( | GWEN_MDIGEST * | md,
|  | const char * | folder,
|  | const char * | checksumFile,
|  | int | strictCheck,
|  | uint32_t | pid )

This function verifies the integrity of a given file hierarchy by comparing checksums saved in a given file inside that file tree to the actual checksums of the files in the file tree.

Parameters

  md | digest algorithm to use (see GWEN_MDigest_Rmd160_new et al)
  folder | folder to check
  checkSumFile | name of the file containing the checksums
  strictCheck | if !=0 then an error will be returned if there are files in the tree for which there is no corresponding entry in the checksum file
  pid | id of the open progress dialog (see GWEN_Gui_ProgressStart)

## GWEN_MDigest_Digest()

GWENHYWFAR_API int GWEN_MDigest_Digest | ( | GWEN_MDIGEST * | md,
|  | const uint8_t * | srcBuf,
|  | unsigned int | srcLen,
|  | uint8_t * | dstBuf,
|  | unsigned int | dstLen )

Convenience function, this calls GWEN_MDigest_Begin, GWEN_MDigest_Update and GWEN_MDigest_End and copies the resulting hash into the given buffer.

## GWEN_MDigest_End()

GWENHYWFAR_API int GWEN_MDigest_End | ( | GWEN_MDIGEST * | md | ) |

References GWENHYWFAR_API.

## GWEN_MDigest_free()

GWENHYWFAR_API void GWEN_MDigest_free | ( | GWEN_MDIGEST * | md | ) |

References GWENHYWFAR_API.

## GWEN_MDigest_GetDigestPtr()

GWENHYWFAR_API uint8_t * GWEN_MDigest_GetDigestPtr | ( | GWEN_MDIGEST * | md | ) |

References GWENHYWFAR_API.

## GWEN_MDigest_GetDigestSize()

GWENHYWFAR_API unsigned int GWEN_MDigest_GetDigestSize | ( | GWEN_MDIGEST * | md | ) |

References GWENHYWFAR_API.

## GWEN_MDigest_GetHashAlgoId()

GWENHYWFAR_API GWEN_CRYPT_HASHALGOID GWEN_MDigest_GetHashAlgoId | ( | const GWEN_MDIGEST * | md | ) |

References GWEN_CRYPT_HASHALGOID, and GWENHYWFAR_API.

## GWEN_MDigest_HashFileTree()

GWENHYWFAR_API int GWEN_MDigest_HashFileTree | ( | GWEN_MDIGEST * | md,
|  | const char * | folder,
|  | const char * | ignoreFile,
|  | GWEN_STRINGLIST * | sl )

References GWENHYWFAR_API.

## GWEN_MDigest_Md5_new()

GWENHYWFAR_API GWEN_MDIGEST * GWEN_MDigest_Md5_new | ( | void |  | ) |

References GWENHYWFAR_API.

## GWEN_MDigest_PBKDF2()

GWENHYWFAR_API int GWEN_MDigest_PBKDF2 | ( | GWEN_MDIGEST * | md,
|  | const char * | password,
|  | const uint8_t * | pSalt,
|  | uint32_t | lSalt,
|  | uint8_t * | pKey,
|  | uint32_t | lKey,
|  | uint32_t | iterations )

Generate a key from a given password and a salt according to RFC 2898.

References GWENHYWFAR_API.

## GWEN_MDigest_Rmd160_new()

GWENHYWFAR_API GWEN_MDIGEST * GWEN_MDigest_Rmd160_new | ( | void |  | ) |

References GWENHYWFAR_API.

## GWEN_MDigest_Sha1_new()

GWENHYWFAR_API GWEN_MDIGEST * GWEN_MDigest_Sha1_new | ( | void |  | ) |

References GWENHYWFAR_API.

## GWEN_MDigest_Sha256_new()

GWENHYWFAR_API GWEN_MDIGEST * GWEN_MDigest_Sha256_new | ( | void |  | ) |

References GWENHYWFAR_API.

## GWEN_MDigest_Update()

GWENHYWFAR_API int GWEN_MDigest_Update | ( | GWEN_MDIGEST * | md,
|  | const uint8_t * | buf,
|  | unsigned int | l )

References GWENHYWFAR_API.