Main Page   File List   File Members   Related Pages  

frdi_lib.c File Reference

miscellaneous core library methods More...

#include "frdi.h"

Functions

char * frdiTimestampNow ()
void * frdiMemoryAllocate (int size)
void frdiMemoryFree (void *ptr)
void frdiInitialiseTiger ()
char * frdiHashTiger (char *message)
char * frdiHash (char *message)
frdi_bigint * frdiBigintNew (frdi_app *self)
int frdiRandInt (frdi_app *self, int start, int finish)
frdi_bigint * frdiRandBigint (frdi_app *self, frdi_bigint *finish, frdi_seed *seed)
frdi_seed * frdiRandSeedNew (frdi_app *self, char *randomness)
char * frdiRandGenerate (frdi_app *self)
char * frdiBigintToHex (frdi_app *self, frdi_bigint *num)
frdi_bigint * frdiHexToBigint (frdi_app *self, char *str)

Variables

_hash_descriptor tiger


Detailed Description

miscellaneous core library methods

Author:
Douglas Reay <douglas-legal@reay.org>
Warning:

Function Documentation

char* frdiTimestampNow  
 

returns the current time as a string YYYY-MM-DD HH:MM:SS uses the UTC timezone to ensure coordination between clients and servers in different timezones. CHANGED TO: timestamp - YYYY-MM-DDThh:mm:ssTZ http://www.w3.org/TR/html4/types.html#h-6.5

void* frdiMemoryAllocate int    size
 

Put here to allow easy later aleration to a more efficient mechanism. There should be no direct calls to malloc() from anywhere else.

void frdiMemoryFree void *    ptr
 

Put here to allow easy later aleration to a more efficient mechanism. There should be no direct calls to free() from anywhere else.

void frdiInitialiseTiger  
 

This must only ever be called once

char* frdiHashTiger char *    message
 

uses the Tiger message digest algorithm to create a digest of a message

char* frdiHash char *    message
 

I havn't decided yet what to do about allowing multiple algorithms. For now this defaults to Tiger.

frdi_bigint* frdiBigintNew frdi_app *    self
 

returns a correctly initialised pointer to a frdi_bigint

int frdiRandInt frdi_app *    self,
int    start,
int    finish
 

Returns a random integer between start and finish, inclusive

frdi_bigint* frdiRandBigint frdi_app *    self,
frdi_bigint *    finish,
frdi_seed *    seed
 

Returns a random bigint between 0 and finish - 1

frdi_seed* frdiRandSeedNew frdi_app *    self,
char *    randomness
 

Returns a seed (used to keep state for random()) we use the tiger hash of randomness as the salt

char* frdiRandGenerate frdi_app *    self
 

generate a string containing randomness the time, the process currently running, our ip address

char* frdiBigintToHex frdi_app *    self,
frdi_bigint *    num
 

frdi_bigint * -> char* hex string

frdi_bigint* frdiHexToBigint frdi_app *    self,
char *    str
 

char* hex string -> frdi_bigint *


Variable Documentation

struct _hash_descriptor tiger
 

this should be thread safe


Generated on Wed Aug 18 13:24:00 2004 for Project Fairdice by doxygen1.2.18