https://github.com/mackron/md5
MD5 hashing implementation.
https://github.com/mackron/md5
Last synced: about 1 year ago
JSON representation
MD5 hashing implementation.
- Host: GitHub
- URL: https://github.com/mackron/md5
- Owner: mackron
- Created: 2022-02-13T09:57:45.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2022-12-07T02:48:49.000Z (over 3 years ago)
- Last Synced: 2025-03-25T02:36:51.823Z (about 1 year ago)
- Language: C
- Size: 15.6 KB
- Stars: 12
- Watchers: 3
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
MD5 Hashing
A simple MD5 hashing implementation. Usage:
unsigned char digest[MD5_SIZE];
md5_context ctx;
md5_init(&ctx);
{
md5_update(&ctx, src, sz);
}
md5_finalize(&ctx, digest);
The above code is the literal implementation of `md5()` which is a high level helper for hashing
data of a known size:
unsigned char hash[MD5_SIZE];
md5(hash, data, dataSize);
Use `md5_format()` to format the digest as a hex string. The capacity of the output buffer needs to
be at least `MD5_SIZE_FORMATTED` bytes.
This library does not perform any memory allocations and does not use anything from the standard
library except for `size_t` and `NULL`, both of which are drawn in from stddef.h. No other standard
headers are included.
There is no need to link to anything with this library. You can use MD5_IMPLEMENTATION to define
the implementation section, or you can use md5.c if you prefer a traditional header/source pair.