libgit2

git_odb_hash

Version:

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

The resulting 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 *oid, const void *data, size_t len, git_object_t object_type);

Parameters

Out
oid

the resulting object-ID.

const void *
In
data

data to hash

size_t
In
len

size of the data

In
object_type

of the data to hash

Returns

int

0 or an error code

Versions