SDLGameEngine

SgeMisc

Miscellaneous helper functions. More...

Functions

int sgeGetDistance (int x, int y, int xx, int yy)
 get the distance of two coordinates
char * sgeMD5 (const unsigned char *data, unsigned int datalen)
 get a md5 sum from data
char * sgeSHA1 (const unsigned char *data, unsigned int datalen)
 get a sha1 hash from data

Detailed Description

Miscellaneous helper functions.


Function Documentation

int sgeGetDistance ( int  x,
int  y,
int  xx,
int  yy 
)

get the distance of two coordinates

Parameters:
xx position of point 1
yy position of point 1
XXx position of point 2
yyy position of point 2
Returns:
the distance of the two points

Definition at line 11 of file sgemisc.c.

char* sgeMD5 ( const unsigned char *  data,
unsigned int  datalen 
)

get a md5 sum from data

Parameters:
dataa unsigned char pointer to your data
datalenthe length in bytes of your data
Returns:
a new allocated char * pointer representing the hex string of the md5

example:

 const char testtext[]="some text";

 char *md5=sgeMD5((const unsigned char *)testtext, (unsigned int) strlen(testtext));
 printf("%s\n",md5);
 sgeFree(md5);

Definition at line 18 of file sgemisc.c.

char* sgeSHA1 ( const unsigned char *  data,
unsigned int  datalen 
)

get a sha1 hash from data

Parameters:
dataa unsigned char pointer to your data
datalenthe length in bytes of your data
Returns:
a new allocated char * pointer representing the hex string of the sha1

example:

 char *sha1=sgeSHA1((const unsigned char *)testtext, (unsigned int) strlen(testtext));
 printf("%s\n",sha1);
 sgeFree(sha1);

Definition at line 35 of file sgemisc.c.

 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Defines