Subversion Repositories mdb

Rev

Rev 49 | Rev 59 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 49 Rev 55
Line 505... Line 505...
505
}
505
}
506
 
506
 
507
char *str2hash(const char *str, int length)
507
char *str2hash(const char *str, int length)
508
{
508
{
509
	uint32_t a, b;
509
	uint32_t a, b;
510
	char *out, digest1[9], digest2[9];
510
	char *out;
511
 
511
 
512
	if ((out = (char *)malloc(17)) == NULL)
512
	if ((out = (char *)malloc(17)) == NULL)
513
	{
513
	{
514
		syslog(LOG_DAEMON, "Error allocating 33 Bytes for MD5 calculation: %s", strerror(errno));
514
		syslog(LOG_DAEMON, "Error allocating 33 Bytes for MD5 calculation: %s", strerror(errno));
515
		return NULL;
515
		return NULL;
516
	}
516
	}
517
 
517
 
518
	memset(out, 0, 17);
518
	memset(out, 0, 17);
519
	a = 0x2e96a73d; b = 0x130f36db;			/* Individual seeds to be able to reproduse the hashes */
519
	a = 0x2e96a73d; b = 0x130f36db;			/* Individual seeds to be able to reproduse the hashes */
520
	hashlittle2(str, length, &a, &b);
520
	hashlittle2(str, length, &a, &b);
-
 
521
#ifdef __APPLE__
-
 
522
	sprintf(out, "%.8x%.8x", a, b);
-
 
523
#else
521
	sprintf(out, "%.8lx%.8lx", a, b);
524
	sprintf(out, "%.8lx%.8lx", a, b);
522
 
525
#endif
523
	return out;
526
	return out;
524
}
527
}
525
 
528
 
526
char *getFileExtension(const char *file)
529
char *getFileExtension(const char *file)
527
{
530
{
528
char *ret, *p1, *p2;
531
char *ret, *p1;
529
 
532
 
530
	if ((p1 = strrchr(file, '.')) == NULL)
533
	if ((p1 = strrchr(file, '.')) == NULL)
531
		return NULL;
534
		return NULL;
532
 
535
 
533
	if (strrchr(p1, '/') != NULL)
536
	if (strrchr(p1, '/') != NULL)