4 * SHA-1 handling related functions
6 * Luiz Fernando N. Capitulino
7 * <lcapitulino@gmail.com>
17 * Convert a 40-byte hexadecimal string SHA1 representation into
18 * a (raw) 20 byte sequence.
20 * \param hex hexdecimal string to be converted
21 * \param sha1 20-byte array to return the conversion result into
23 * \return 0 on success, -1 otherwise.
25 int git_hex_to_sha1(const char *hex
, unsigned char *sha1
)
32 return get_sha1_hex(hex
, sha1
);
36 * Convert a (raw) 20-byte SHA1 sequence into a 40-byte hexadecimal
37 * string representation.
39 * \param sha1 20-byte SHA1 array to be converted
40 * \param hex 41-byte array to be filled with the 40-byte hexadecimal
41 * representation plus the trailing \\0 character
43 * \return 0 on success, -1 otherwise.
45 int git_sha1_to_hex(const unsigned char *sha1
, char *hex
)
54 p
= sha1_to_hex(sha1
);
58 strncpy(hex
, p
, GIT_HEX_LENGTH
+1);