xtk_md5.h
The MD5 digest (RFC 1321), for names and keys other programs make with it.
What it is for. Matching what other programs do: the freedesktop thumbnail cache keeps a file's thumbnail as <md5 of its URI>.png. It is not for security: two different inputs with the same MD5 are easy to make.
Example.
charname[XTK_MD5_HEX_SIZE];
xtk_md5_hex("file:///home/me/a.png",strlen("file:///home/me/a.png"),name);
//nameisnow32lower-casehexdigits
Data can also come in parts: xtk_md5_init(), xtk_md5_update() as often as needed, xtk_md5_final(). Each XtkMd5 is used by one thread at a time; the functions keep nothing of their own, so any number of threads may each have theirs.
#include "xtk_md5.h"
Types: XtkMd5
Constants: XTK_MD5_SIZE, XTK_MD5_HEX_SIZE
Functions: xtk_md5_init, xtk_md5_update, xtk_md5_final, xtk_md5_hex
Types
XtkMd5
A digest being made; its fields are the functions' own.
| Field | Type | Description |
|---|---|---|
state[4] |
uint32_t |
|
length |
uint64_t |
Bytes taken so far. |
block[64] |
unsigned char |
The part of a block not yet digested. |
Constants
XTK_MD5_SIZE
#define XTK_MD5_SIZE 16
The size of a digest, in bytes.
XTK_MD5_HEX_SIZE
#define XTK_MD5_HEX_SIZE 33
The size of a digest written as hex digits, with its ending zero byte.
Functions
xtk_md5_init
void xtk_md5_init(XtkMd5 *md5);
Start a digest.
xtk_md5_update
void xtk_md5_update(XtkMd5 *md5, const void *data, size_t length);
Add bytes to it (data may be NULL when length is 0).
xtk_md5_final
void xtk_md5_final(XtkMd5 *md5, unsigned char digest[XTK_MD5_SIZE]);
End it and write the 16 bytes of the digest; the XtkMd5 must be started again before more use.
xtk_md5_hex
void xtk_md5_hex(const void *data, size_t length, char hex[XTK_MD5_HEX_SIZE]);
The MD5 of some bytes as 32 lower-case hex digits.
| Parameter | Description |
|---|---|
data |
The bytes (may be NULL when length is 0) |
length |
How many |
hex |
Receives the digits and a zero byte: XTK_MD5_HEX_SIZE bytes |
xtk API
Widgets
- button
- checkbox
- radiobutton
- label
- entry
- textview
- edit_history
- spinbutton
- slider
- progressbar
- combobox
- scrollbar
- swatch
- panel
- statusbar
- tooltip
- toolbar
- icongrid
- iconview
- pathbar
- treeview
- datagrid
- graph
- scheme_wheel
- zoom
- tray
Containers and menus
Dialogs
Rich text
Drawing and images
Color
Configuration and themes
Input and the X server
Safety
Data formats