Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
git2
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
lvzhengyang
git2
Commits
0e53e55d
Commit
0e53e55d
authored
Jan 22, 2022
by
Edward Thomson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
hash: introduce git_hash_fmt
A simple hash-to-hexadigit formatter.
parent
a9fc14b0
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
18 additions
and
0 deletions
+18
-0
src/hash.c
+16
-0
src/hash.h
+2
-0
No files found.
src/hash.c
View file @
0e53e55d
...
...
@@ -124,3 +124,19 @@ done:
return
error
;
}
int
git_hash_fmt
(
char
*
out
,
unsigned
char
*
hash
,
size_t
hash_len
)
{
static
char
hex
[]
=
"0123456789abcdef"
;
char
*
str
=
out
;
size_t
i
;
for
(
i
=
0
;
i
<
hash_len
;
i
++
)
{
*
str
++
=
hex
[
hash
[
i
]
>>
4
];
*
str
++
=
hex
[
hash
[
i
]
&
0x0f
];
}
*
str
++
=
'\0'
;
return
0
;
}
src/hash.h
View file @
0e53e55d
...
...
@@ -41,4 +41,6 @@ int git_hash_final(unsigned char *out, git_hash_ctx *c);
int
git_hash_buf
(
unsigned
char
*
out
,
const
void
*
data
,
size_t
len
,
git_hash_algorithm_t
algorithm
);
int
git_hash_vec
(
unsigned
char
*
out
,
git_str_vec
*
vec
,
size_t
n
,
git_hash_algorithm_t
algorithm
);
int
git_hash_fmt
(
char
*
out
,
unsigned
char
*
hash
,
size_t
hash_len
);
#endif
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment