Skip Headers
Oracle Hierarchical Storage Manager and QFS Software Command Reference
Section 3: Introduction to Library Functions
Release 6.1.1
E70305-03

NAME

sam_getdigest - Gets message-digest hash value for a file

SYNOPSIS

cc [ flag … ] file … -L∕opt∕SUNWsamfs∕lib -lsam [ library … ]

#include "∕opt∕SUNWsamfs∕include∕lib.h"

int sam_getdigest(const char * path , char * digest , int size );

DESCRIPTION

sam_getdigest (3x) returns a file's message-digest hash value as ASCII character string of a file using an Oracle HSM library call.

path is the file on which to get the message-digest.

digest is the character string receiving the message-digest string. The string must be large enough to hold the returned string. The current maximum of the message-digest string is 139 characters; it is recommended that the size be 256 characters for future expansion.

size is the size available in the message digest string.

If the function was successful, the message-digest is returned as an string with fields separated by semicolons. The format is:

algorithm-name:[algorithm-number]:message-digest

  • The algorithm-name is a string with the algorithm value used in the ssum command.

  • The algorithm-number is a string surrounded in brackets, [], with the cooresponding algorithm number used in the sam_ssum() API function.

  • The message-digest is a ASCII character string with the message-digest's hash value presented as two hexadecimal characters per byte.

RETURN VALUES

Upon successful completion, a value of 0 is returned. Otherwise, a value of -1 is returned and errno is set to indicate the error.

ERRORS

sam_getdigest() fails if one or more of the following are true:

EINVAL

The named file is not a regular file.

EPERM

Not the owner or super-user.

EFAULT

path or digest points to an illegal address.

EINTR

A signal was caught during the sam_getdigest() function.

ELOOP

Too many symbolic links were encountered in translating path.

ENAMETOOLONG

The length of the path argument exceeds {PATH_MAX}, or the length of a path component exceeds {NAME_MAX} while {_POSIX_NO_TRUNC} is in effect.

ENOENT

The named file does not exist or is the null pathname.

ENOTSUP

The named file does not have an extended algorithm message-digest.

ENOMEM

The size of the string receiving the message-digest is too small.

ENOTDIR

A component of the path prefix is not a directory.

SEE ALSO

ssum (1).

sam_ssum (3x).

fixity (7).