Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
L
liblongpath-rsync
Project
Project
Details
Activity
Releases
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
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
liblongpath
liblongpath-rsync
Commits
2fb27e91
Commit
2fb27e91
authored
Nov 04, 1998
by
Andrew Tridgell
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
use macros to make mdfour faster on systems that don't do inlining
well. Also helps when optimisation level is low.
parent
946347b8
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
23 deletions
+11
-23
mdfour.c
lib/mdfour.c
+11
-23
No files found.
lib/mdfour.c
View file @
2fb27e91
...
...
@@ -28,30 +28,14 @@
static
struct
mdfour
*
m
;
static
inline
uint32
F
(
uint32
X
,
uint32
Y
,
uint32
Z
)
{
return
(
X
&
Y
)
|
((
~
X
)
&
Z
);
}
static
inline
uint32
G
(
uint32
X
,
uint32
Y
,
uint32
Z
)
{
return
(
X
&
Y
)
|
(
X
&
Z
)
|
(
Y
&
Z
);
}
static
inline
uint32
H
(
uint32
X
,
uint32
Y
,
uint32
Z
)
{
return
X
^
Y
^
Z
;
}
static
inline
uint32
lshift
(
uint32
x
,
int
s
)
{
#define F(X,Y,Z) (((X)&(Y)) | ((~(X))&(Z)))
#define G(X,Y,Z) (((X)&(Y)) | ((X)&(Z)) | ((Y)&(Z)))
#define H(X,Y,Z) ((X)^(Y)^(Z))
#ifdef LARGE_INT32
x
&=
0xFFFFFFFF
;
return
((
x
<<
s
)
&
0xFFFFFFFF
)
|
(
x
>>
(
32
-
s
));
#define lshift(x,s) ((((x)<<(s))&0xFFFFFFFF) | (((x)>>(32-(s)))&0xFFFFFFFF))
#else
return
((
x
<<
s
)
|
(
x
>>
(
32
-
s
)));
#define lshift(x,s) (((x)<<(s)) | ((x)>>(32-(s))))
#endif
}
#define ROUND1(a,b,c,d,k,s) a = lshift(a + F(b,c,d) + X[k], s)
#define ROUND2(a,b,c,d,k,s) a = lshift(a + G(b,c,d) + X[k] + 0x5A827999,s)
...
...
@@ -209,8 +193,8 @@ static void file_checksum1(char *fname)
{
int
fd
,
i
;
struct
mdfour
md
;
unsigned
char
buf
[
64
],
sum
[
16
];
unsigned
char
buf
[
64
*
1024
],
sum
[
16
];
fd
=
open
(
fname
,
O_RDONLY
);
if
(
fd
==
-
1
)
{
perror
(
"fname"
);
...
...
@@ -234,6 +218,7 @@ static void file_checksum1(char *fname)
printf
(
"
\n
"
);
}
#if 0
#include "../md4.h"
static void file_checksum2(char *fname)
...
...
@@ -268,11 +253,14 @@ static void file_checksum2(char *fname)
printf("%02X", sum[i]);
printf("\n");
}
#endif
int
main
(
int
argc
,
char
*
argv
[])
{
file_checksum1
(
argv
[
1
]);
#if 0
file_checksum2(argv[1]);
#endif
return
0
;
}
#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