SDLGameEngine

- Main Page
- Related Pages
- Modules
- Data Structures
- Files

Functions

# 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:

  x | x position of point 1
  y | y position of point 1
  XX | x position of point 2
  yy | y 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:

  data | a unsigned char pointer to your data
  datalen | the 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:

  data | a unsigned char pointer to your data
  datalen | the 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