Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
Synchronet
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD 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
Main
Synchronet
Commits
24d2e68e
Commit
24d2e68e
authored
20 years ago
by
rswindell
Browse files
Options
Downloads
Patches
Plain Diff
Support DLL-exporting of MD5 functions.
parent
d364bf0f
No related branches found
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/hash/md5.c
+5
-5
5 additions, 5 deletions
src/hash/md5.c
src/hash/md5.h
+29
-5
29 additions, 5 deletions
src/hash/md5.h
with
34 additions
and
10 deletions
src/hash/md5.c
+
5
−
5
View file @
24d2e68e
...
@@ -34,7 +34,7 @@ documentation and/or software.
...
@@ -34,7 +34,7 @@ documentation and/or software.
#define LITTLE_ENDIAN
/* Little Endian by default */
#define LITTLE_ENDIAN
/* Little Endian by default */
#endif
#endif
void
MD5_open
(
MD5
*
md5
)
void
DLLCALL
MD5_open
(
MD5
*
md5
)
{
{
md5
->
count
[
0
]
=
md5
->
count
[
1
]
=
0
;
md5
->
count
[
0
]
=
md5
->
count
[
1
]
=
0
;
/* Load magic initialization constants.*/
/* Load magic initialization constants.*/
...
@@ -194,7 +194,7 @@ static void MD5Transform(UINT4 state[4], const BYTE block[64])
...
@@ -194,7 +194,7 @@ static void MD5Transform(UINT4 state[4], const BYTE block[64])
memset
(
x
,
0
,
sizeof
(
x
));
memset
(
x
,
0
,
sizeof
(
x
));
}
}
void
MD5_digest
(
MD5
*
md5
,
const
void
*
input
,
size_t
inputLen
)
void
DLLCALL
MD5_digest
(
MD5
*
md5
,
const
void
*
input
,
size_t
inputLen
)
{
{
unsigned
int
i
,
index
,
partLen
;
unsigned
int
i
,
index
,
partLen
;
/* Compute number of bytes mod 64 */
/* Compute number of bytes mod 64 */
...
@@ -229,7 +229,7 @@ void MD5_digest(MD5 *md5, const void *input, size_t inputLen)
...
@@ -229,7 +229,7 @@ void MD5_digest(MD5 *md5, const void *input, size_t inputLen)
#define ENCODE(p,n) (p)[0]=n,(p)[1]=n>>8,(p)[2]=n>>16,(p)[3]=n>>24
#define ENCODE(p,n) (p)[0]=n,(p)[1]=n>>8,(p)[2]=n>>16,(p)[3]=n>>24
#endif
#endif
void
MD5_close
(
MD5
*
md5
,
BYTE
digest
[
MD5_DIGEST_SIZE
])
void
DLLCALL
MD5_close
(
MD5
*
md5
,
BYTE
digest
[
MD5_DIGEST_SIZE
])
{
{
BYTE
bits
[
8
];
BYTE
bits
[
8
];
unsigned
int
index
,
padLen
;
unsigned
int
index
,
padLen
;
...
@@ -257,7 +257,7 @@ void MD5_close(MD5 *md5, BYTE digest[MD5_DIGEST_SIZE])
...
@@ -257,7 +257,7 @@ void MD5_close(MD5 *md5, BYTE digest[MD5_DIGEST_SIZE])
memset
(
md5
,
0
,
sizeof
(
MD5
));
memset
(
md5
,
0
,
sizeof
(
MD5
));
}
}
BYTE
*
MD5_calc
(
BYTE
digest
[
MD5_DIGEST_SIZE
],
const
void
*
buf
,
size_t
len
)
BYTE
*
DLLCALL
MD5_calc
(
BYTE
digest
[
MD5_DIGEST_SIZE
],
const
void
*
buf
,
size_t
len
)
{
{
MD5
ctx
;
MD5
ctx
;
...
@@ -270,7 +270,7 @@ BYTE* MD5_calc(BYTE digest[MD5_DIGEST_SIZE], const void* buf, size_t len)
...
@@ -270,7 +270,7 @@ BYTE* MD5_calc(BYTE digest[MD5_DIGEST_SIZE], const void* buf, size_t len)
/* conversion for 16 character binary md5 to hex */
/* conversion for 16 character binary md5 to hex */
BYTE
*
MD5_hex
(
BYTE
*
to
,
const
BYTE
digest
[
MD5_DIGEST_SIZE
])
BYTE
*
DLLCALL
MD5_hex
(
BYTE
*
to
,
const
BYTE
digest
[
MD5_DIGEST_SIZE
])
{
{
BYTE
const
*
from
=
digest
;
BYTE
const
*
from
=
digest
;
static
char
*
hexdigits
=
"0123456789abcdef"
;
static
char
*
hexdigits
=
"0123456789abcdef"
;
...
...
This diff is collapsed.
Click to expand it.
src/hash/md5.h
+
29
−
5
View file @
24d2e68e
...
@@ -50,15 +50,39 @@ typedef struct
...
@@ -50,15 +50,39 @@ typedef struct
BYTE
buffer
[
64
];
BYTE
buffer
[
64
];
}
MD5
;
}
MD5
;
#if defined(DLLEXPORT)
#undef DLLEXPORT
#endif
#if defined(DLLCALL)
#undef DLLCALL
#endif
#if defined(_WIN32) && (defined(MD5_IMPORTS) || defined(MD5_EXPORTS))
#if defined(MD5_IMPORTS)
#define DLLEXPORT __declspec(dllimport)
#else
#define DLLEXPORT __declspec(dllexport)
#endif
#if defined(__BORLANDC__)
#define DLLCALL __stdcall
#else
#define DLLCALL
#endif
#else
/* !_WIN32 || !_DLL*/
#define DLLEXPORT
#define DLLCALL
#endif
#ifdef __cplusplus
#ifdef __cplusplus
extern
"C"
{
extern
"C"
{
#endif
#endif
void
MD5_open
(
MD5
*
ctx
);
DLLEXPORT
void
DLLCALL
MD5_open
(
MD5
*
ctx
);
void
MD5_digest
(
MD5
*
ctx
,
const
void
*
buf
,
size_t
len
);
DLLEXPORT
void
DLLCALL
MD5_digest
(
MD5
*
ctx
,
const
void
*
buf
,
size_t
len
);
void
MD5_close
(
MD5
*
ctx
,
BYTE
digest
[
MD5_DIGEST_SIZE
]);
DLLEXPORT
void
DLLCALL
MD5_close
(
MD5
*
ctx
,
BYTE
digest
[
MD5_DIGEST_SIZE
]);
BYTE
*
MD5_calc
(
BYTE
digest
[
MD5_DIGEST_SIZE
],
const
void
*
buf
,
size_t
len
);
DLLEXPORT
BYTE
*
DLLCALL
MD5_calc
(
BYTE
digest
[
MD5_DIGEST_SIZE
],
const
void
*
buf
,
size_t
len
);
BYTE
*
MD5_hex
(
BYTE
*
dest
,
const
BYTE
digest
[
MD5_DIGEST_SIZE
]);
DLLEXPORT
BYTE
*
DLLCALL
MD5_hex
(
BYTE
*
dest
,
const
BYTE
digest
[
MD5_DIGEST_SIZE
]);
#ifdef __cplusplus
#ifdef __cplusplus
}
}
...
...
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