Logo Search packages:      
Sourcecode: libtomcrypt version File versions  Download package

int hash_file ( int  hash,
const char *  fname,
unsigned char *  out,
unsigned long *  outlen 
hashThe index of the hash desired
fnameThe name of the file you wish to hash
out[out] The destination of the digest
outlen[in/out] The max size and resulting size of the message digest
CRYPT_OK if successful

Definition at line 25 of file hash_file.c.

References hash_filehandle().

#ifdef LTC_NO_FILE
    return CRYPT_NOP;
    FILE *in;
    int err;
    LTC_ARGCHK(fname  != NULL);
    LTC_ARGCHK(out    != NULL);
    LTC_ARGCHK(outlen != NULL);

    if ((err = hash_is_valid(hash)) != CRYPT_OK) {
        return err;

    in = fopen(fname, "rb");
    if (in == NULL) { 
       return CRYPT_FILE_NOTFOUND;

    err = hash_filehandle(hash, in, out, outlen);
    if (fclose(in) != 0) {
       return CRYPT_ERROR;

    return err;

Here is the call graph for this function:

Generated by  Doxygen 1.6.0   Back to index