Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
N
nettle
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Container registry
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
David Carlier
nettle
Commits
49b2a7eb
Commit
49b2a7eb
authored
15 years ago
by
Niels Möller
Browse files
Options
Downloads
Patches
Plain Diff
Minor cleanup. Added comment on how to optimize f3.
Rev: nettle/sha1-compress.c:1.2
parent
343b4bad
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
sha1-compress.c
+9
-3
9 additions, 3 deletions
sha1-compress.c
with
9 additions
and
3 deletions
sha1-compress.c
+
9
−
3
View file @
49b2a7eb
...
...
@@ -66,12 +66,18 @@
save one boolean operation each - thanks to Rich Schroeppel,
rcs@cs.arizona.edu for discovering this */
/* FIXME: Can save a temporary in f3 by using ( (x & y) + (z & (x ^
y)) ), and then, in the round, compute one of the terms and add it
into the destination word before computing the second term. Credits
to George Spelvin for pointing this out. Unfortunately, gcc
doesn't seem to be smart enough to take advantage of this. */
/* #define f1(x,y,z) ( ( x & y ) | ( ~x & z ) ) Rounds 0-19 */
#define f1(x,y,z) ( z ^ ( x & ( y ^ z ) ) )
/* Rounds 0-19 */
#define f2(x,y,z) ( x ^ y ^ z )
/* Rounds 20-39 */
/* #define f3(x,y,z) ( ( x & y ) | ( x & z ) | ( y & z ) ) Rounds 40-59 */
#define f3(x,y,z) ( ( x & y ) | ( z & ( x | y ) ) )
/* Rounds 40-59 */
#define f4
(x,y,z) ( x ^ y ^ z )
/* Rounds 60-79 */
#define f4
f2
/* The SHA Mysterious Constants */
...
...
@@ -127,11 +133,11 @@
void
_nettle_sha1_compress
(
uint32_t
*
state
,
const
uint8_t
*
input
)
{
uint32_t
data
[
16
];
uint32_t
data
[
SHA1_DATA_LENGTH
];
uint32_t
A
,
B
,
C
,
D
,
E
;
/* Local vars */
int
i
;
for
(
i
=
0
;
i
<
16
;
i
++
,
input
+=
4
)
for
(
i
=
0
;
i
<
SHA1_DATA_LENGTH
;
i
++
,
input
+=
4
)
{
data
[
i
]
=
READ_UINT32
(
input
);
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment