libgit2

git_odb_hash

Version:

Determine the object-ID (sha1 hash) of a data buffer

The resulting SHA-1 OID will be the identifier for the data buffer as if the data buffer it were to written to the ODB.

Signature

int git_odb_hash(git_oid *out, const void *data, size_t len, git_object_t type);

Parameters

In
out

the resulting object-ID.

const void *
In
data

data to hash

size_t
In
len

size of the data

In
type

of the data to hash

Returns

int

0 or an error code

Versions