dmlite  0.6
Functions
checksums.h File Reference
#include <stddef.h>
#include "io.h"
Include dependency graph for checksums.h:

Go to the source code of this file.

Functions

char * dmlite_checksum_full_name (const char *shortName, char *output, size_t osize)
 Puts into output the full name of the checksum algorithm specified with shortName. More...
 
char * dmlite_checksum_short_name (const char *longName, char *output, size_t osize)
 Puts into output the short name of the checksum algorithm specified with longName. More...
 
int dmlite_checksum_md5 (dmlite_fd *fd, off_t offset, off_t size, char *output, size_t outsize)
 Generated the MD5 checksum of the given file. More...
 
int dmlite_checksum_crc32 (dmlite_fd *fd, off_t offset, off_t size, char *output, size_t outsize)
 Generated the CRC32 checksum of the given file. More...
 
int dmlite_checksum_adler32 (dmlite_fd *fd, off_t offset, off_t size, char *output, size_t outsize)
 Generated the Adler32 checksum of the given file. More...
 

Function Documentation

◆ dmlite_checksum_adler32()

int dmlite_checksum_adler32 ( dmlite_fd fd,
off_t  offset,
off_t  size,
char *  output,
size_t  outsize 
)

Generated the Adler32 checksum of the given file.

Parameters
fdThe file descriptor where to read the data to digest.
offsetWhere to start to digest.
sizeThe number of bytes to digest. 0 means the whole file.
outputWhere to put the resulting checksum (in hexadecimal)
outsizeThe size of the memory area pointed by output.
Returns
0 on success, error code otherwise.

◆ dmlite_checksum_crc32()

int dmlite_checksum_crc32 ( dmlite_fd fd,
off_t  offset,
off_t  size,
char *  output,
size_t  outsize 
)

Generated the CRC32 checksum of the given file.

Parameters
fdThe file descriptor where to read the data to digest.
offsetWhere to start to digest.
sizeThe number of bytes to digest. 0 means the whole file.
outputWhere to put the resulting checksum (in decimal)
outsizeThe size of the memory area pointed by output.
Returns
0 on success, error code otherwise.

◆ dmlite_checksum_full_name()

char* dmlite_checksum_full_name ( const char *  shortName,
char *  output,
size_t  osize 
)

Puts into output the full name of the checksum algorithm specified with shortName.

Parameters
shortNameThe checksum short name (CS, AD, MD)
outputThe full name will be put here.
osizeThe size of the buffer pointed by output.
Returns
The same value as the pointer output

◆ dmlite_checksum_md5()

int dmlite_checksum_md5 ( dmlite_fd fd,
off_t  offset,
off_t  size,
char *  output,
size_t  outsize 
)

Generated the MD5 checksum of the given file.

Parameters
fdThe file descriptor where to read the data to digest.
offsetWhere to start to digest.
sizeThe number of bytes to digest. 0 means the whole file.
outputWhere to put the resulting checksum (in hexadecimal)
outsizeThe size of the memory area pointed by output.
Returns
0 on success, error code otherwise.

◆ dmlite_checksum_short_name()

char* dmlite_checksum_short_name ( const char *  longName,
char *  output,
size_t  osize 
)

Puts into output the short name of the checksum algorithm specified with longName.

Parameters
shortNameThe checksum long name (MD5, ADLER32, ...)
outputThe short name will be put here.
osizeThe size of the buffer pointed by output.
Returns
The same value as the pointer output