Exemplo n.º 1
0
void
test_rmd160(const char *digest, const char *string)
{
	char result[RMD160_DIGEST_STRING_LENGTH];

	assert(strcmp(digest, RMD160Data(string, strlen(string), result)) == 0);
}
Exemplo n.º 2
0
int
main(int argc, char **argv)
{
	RMD160_CTX ctx;
	unsigned char *data = malloc(10);
	char ret[32];

	strlcpy(data, "123456789", 10);

	RMD160Init(&ctx);
	RMD160Data(data, sizeof data, ret);
	printf("%s\n", ret);
}
Exemplo n.º 3
0
static char *
getedidhash1(XRRScreenResources *resources)
{
	uint8_t				*edids = NULL;
	char				*edidhash;
	unsigned char			*prop;
	Atom				 edid_atom, actual_type;
	unsigned long			 edid_nitems, new_nitems = 0, nitems = 0;
	unsigned long			 bytes_after;
	int				 i, actual_format;

	edid_atom = XInternAtom(dpy, RR_PROPERTY_RANDR_EDID, 0);

	for (i = 0; i < resources->noutput; ++i) {
		XRRGetOutputProperty(dpy, resources->outputs[i], edid_atom, 0,
			100, 0, 0, AnyPropertyType, &actual_type,
			&actual_format, &edid_nitems, &bytes_after, &prop);

		if (actual_type == XA_INTEGER && actual_format == 8) {
			new_nitems += edid_nitems;
			edids = reallocarray(edids, new_nitems, sizeof(*edids));
			if(edids == NULL)
				err(1, "malloc");

			memcpy(edids + nitems, prop, edid_nitems);
			nitems = new_nitems;
		}

		XFree(prop);
	}

	if (edids == NULL)
		return (NULL);

	edidhash = RMD160Data(edids, sizeof(*edids) * nitems, NULL);
	free(edids);
	return (edidhash);
}