diff options
| author | Edward Thomson <ethomson@edwardthomson.com> | 2022-01-25 10:32:47 -0500 |
|---|---|---|
| committer | Edward Thomson <ethomson@edwardthomson.com> | 2022-06-20 17:05:29 -0400 |
| commit | 0db1c57cf0cd555db456ebf854ac99aeb68b83cf (patch) | |
| tree | 9c225d18a7ba208bddc0bcec0baa245607a22e50 /include/git2 | |
| parent | 3fbf580c91935ccdea25a135204419991f503b63 (diff) | |
| download | libgit2-0db1c57cf0cd555db456ebf854ac99aeb68b83cf.tar.gz | |
oid: add sha256 typed oids
Diffstat (limited to 'include/git2')
| -rw-r--r-- | include/git2/oid.h | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/include/git2/oid.h b/include/git2/oid.h index 8feb0a358..924c680cc 100644 --- a/include/git2/oid.h +++ b/include/git2/oid.h @@ -19,18 +19,21 @@ */ GIT_BEGIN_DECL -/** The type of object id, currently only SHA1. */ +/** The type of object id. */ typedef enum { - GIT_OID_SHA1 = 1 /**< SHA1 */ + GIT_OID_SHA1 = 1, /**< SHA1 */ + GIT_OID_SHA256 = 2 /**< SHA256 */ } git_oid_t; /** Size (in bytes) of a raw/binary oid */ #define GIT_OID_SHA1_SIZE 20 -#define GIT_OID_MAX_SIZE GIT_OID_SHA1_SIZE +#define GIT_OID_SHA256_SIZE 32 +#define GIT_OID_MAX_SIZE GIT_OID_SHA256_SIZE /** Size (in bytes) of a hex formatted oid */ #define GIT_OID_SHA1_HEXSIZE (GIT_OID_SHA1_SIZE * 2) -#define GIT_OID_MAX_HEXSIZE GIT_OID_SHA1_HEXSIZE +#define GIT_OID_SHA256_HEXSIZE (GIT_OID_SHA256_SIZE * 2) +#define GIT_OID_MAX_HEXSIZE GIT_OID_SHA256_HEXSIZE /** Minimum length (in number of hex characters, * i.e. packets of 4 bits) of an oid prefix */ @@ -49,11 +52,13 @@ typedef struct git_oid { * The binary representation of the null object ID. */ #define GIT_OID_SHA1_ZERO { GIT_OID_SHA1, { 0 } } +#define GIT_OID_SHA256_ZERO { GIT_OID_SHA256, { 0 } } /** * The string representation of the null object ID. */ #define GIT_OID_SHA1_HEXZERO "0000000000000000000000000000000000000000" +#define GIT_OID_SHA256_HEXZERO "0000000000000000000000000000000000000000000000000000000000000000" /** * Parse a hex formatted object id into a git_oid. |
