Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
N
nettle
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Labels
Merge Requests
5
Merge Requests
5
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
Nettle
nettle
Commits
af89b978
Commit
af89b978
authored
Mar 26, 2010
by
Niels Möller
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
(sha1_digest): Use _nettle_write_be32.
Rev: nettle/sha1.c:1.2
parent
e6dc6b62
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
2 additions
and
34 deletions
+2
-34
sha1.c
sha1.c
+2
-34
No files found.
sha1.c
View file @
af89b978
...
...
@@ -47,6 +47,7 @@
#include "sha.h"
#include "macros.h"
#include "nettle-write.h"
/* A block, treated as a sequence of 32-bit words. */
#define SHA1_DATA_LENGTH 16
...
...
@@ -164,42 +165,9 @@ sha1_digest(struct sha1_ctx *ctx,
unsigned
length
,
uint8_t
*
digest
)
{
unsigned
i
;
unsigned
words
;
unsigned
leftover
;
assert
(
length
<=
SHA1_DIGEST_SIZE
);
sha1_final
(
ctx
);
words
=
length
/
4
;
leftover
=
length
%
4
;
for
(
i
=
0
;
i
<
words
;
i
++
,
digest
+=
4
)
WRITE_UINT32
(
digest
,
ctx
->
digest
[
i
]);
if
(
leftover
)
{
uint32_t
word
;
unsigned
j
=
leftover
;
assert
(
i
<
_SHA1_DIGEST_LENGTH
);
word
=
ctx
->
digest
[
i
];
switch
(
leftover
)
{
default:
abort
();
case
3
:
digest
[
--
j
]
=
(
word
>>
8
)
&
0xff
;
/* Fall through */
case
2
:
digest
[
--
j
]
=
(
word
>>
16
)
&
0xff
;
/* Fall through */
case
1
:
digest
[
--
j
]
=
(
word
>>
24
)
&
0xff
;
}
}
_nettle_write_be32
(
length
,
digest
,
ctx
->
digest
);
sha1_init
(
ctx
);
}
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