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
3fff5970
Commit
3fff5970
authored
Sep 29, 2021
by
Edward Thomson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
hash: don't abbreviate algorithm
parent
b7bad55e
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
13 deletions
+13
-13
src/hash.c
+9
-9
src/hash.h
+4
-4
No files found.
src/hash.c
View file @
3fff5970
...
@@ -19,15 +19,15 @@ int git_hash_ctx_init(git_hash_ctx *ctx)
...
@@ -19,15 +19,15 @@ int git_hash_ctx_init(git_hash_ctx *ctx)
if
((
error
=
git_hash_sha1_ctx_init
(
&
ctx
->
ctx
.
sha1
))
<
0
)
if
((
error
=
git_hash_sha1_ctx_init
(
&
ctx
->
ctx
.
sha1
))
<
0
)
return
error
;
return
error
;
ctx
->
algo
=
GIT_HASH_ALGO
_SHA1
;
ctx
->
algo
rithm
=
GIT_HASH_ALGORITHM
_SHA1
;
return
0
;
return
0
;
}
}
void
git_hash_ctx_cleanup
(
git_hash_ctx
*
ctx
)
void
git_hash_ctx_cleanup
(
git_hash_ctx
*
ctx
)
{
{
switch
(
ctx
->
algo
)
{
switch
(
ctx
->
algo
rithm
)
{
case
GIT_HASH_ALGO_SHA1
:
case
GIT_HASH_ALGO
RITHM
_SHA1
:
git_hash_sha1_ctx_cleanup
(
&
ctx
->
ctx
.
sha1
);
git_hash_sha1_ctx_cleanup
(
&
ctx
->
ctx
.
sha1
);
return
;
return
;
default:
default:
...
@@ -37,8 +37,8 @@ void git_hash_ctx_cleanup(git_hash_ctx *ctx)
...
@@ -37,8 +37,8 @@ void git_hash_ctx_cleanup(git_hash_ctx *ctx)
int
git_hash_init
(
git_hash_ctx
*
ctx
)
int
git_hash_init
(
git_hash_ctx
*
ctx
)
{
{
switch
(
ctx
->
algo
)
{
switch
(
ctx
->
algo
rithm
)
{
case
GIT_HASH_ALGO_SHA1
:
case
GIT_HASH_ALGO
RITHM
_SHA1
:
return
git_hash_sha1_init
(
&
ctx
->
ctx
.
sha1
);
return
git_hash_sha1_init
(
&
ctx
->
ctx
.
sha1
);
default:
default:
/* unreachable */
;
/* unreachable */
;
...
@@ -49,8 +49,8 @@ int git_hash_init(git_hash_ctx *ctx)
...
@@ -49,8 +49,8 @@ int git_hash_init(git_hash_ctx *ctx)
int
git_hash_update
(
git_hash_ctx
*
ctx
,
const
void
*
data
,
size_t
len
)
int
git_hash_update
(
git_hash_ctx
*
ctx
,
const
void
*
data
,
size_t
len
)
{
{
switch
(
ctx
->
algo
)
{
switch
(
ctx
->
algo
rithm
)
{
case
GIT_HASH_ALGO_SHA1
:
case
GIT_HASH_ALGO
RITHM
_SHA1
:
return
git_hash_sha1_update
(
&
ctx
->
ctx
.
sha1
,
data
,
len
);
return
git_hash_sha1_update
(
&
ctx
->
ctx
.
sha1
,
data
,
len
);
default:
default:
/* unreachable */
;
/* unreachable */
;
...
@@ -61,8 +61,8 @@ int git_hash_update(git_hash_ctx *ctx, const void *data, size_t len)
...
@@ -61,8 +61,8 @@ int git_hash_update(git_hash_ctx *ctx, const void *data, size_t len)
int
git_hash_final
(
git_oid
*
out
,
git_hash_ctx
*
ctx
)
int
git_hash_final
(
git_oid
*
out
,
git_hash_ctx
*
ctx
)
{
{
switch
(
ctx
->
algo
)
{
switch
(
ctx
->
algo
rithm
)
{
case
GIT_HASH_ALGO_SHA1
:
case
GIT_HASH_ALGO
RITHM
_SHA1
:
return
git_hash_sha1_final
(
out
,
&
ctx
->
ctx
.
sha1
);
return
git_hash_sha1_final
(
out
,
&
ctx
->
ctx
.
sha1
);
default:
default:
/* unreachable */
;
/* unreachable */
;
...
...
src/hash.h
View file @
3fff5970
...
@@ -18,9 +18,9 @@ typedef struct {
...
@@ -18,9 +18,9 @@ typedef struct {
}
git_buf_vec
;
}
git_buf_vec
;
typedef
enum
{
typedef
enum
{
GIT_HASH_ALGO
_UNKNOWN
=
0
,
GIT_HASH_ALGO
RITHM_NONE
=
0
,
GIT_HASH_ALGO
_SHA1
,
GIT_HASH_ALGO
RITHM_SHA1
}
git_hash_algo_t
;
}
git_hash_algo
rithm
_t
;
#include "hash/sha1.h"
#include "hash/sha1.h"
...
@@ -28,7 +28,7 @@ typedef struct git_hash_ctx {
...
@@ -28,7 +28,7 @@ typedef struct git_hash_ctx {
union
{
union
{
git_hash_sha1_ctx
sha1
;
git_hash_sha1_ctx
sha1
;
}
ctx
;
}
ctx
;
git_hash_algo
_t
algo
;
git_hash_algo
rithm_t
algorithm
;
}
git_hash_ctx
;
}
git_hash_ctx
;
int
git_hash_global_init
(
void
);
int
git_hash_global_init
(
void
);
...
...
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