Game Development Community

dev|Pro Game Development Curriculum

CRC32 for Torque

by Daniel Neilsen · 02/01/2002 (9:22 pm) · 2 comments

This is really quite simple.

Just add this function into consoleFunctions.cc

ConsoleFunction(getStringCRC, S32, 2, 2, "getStringCRC(string)")
{
	argc;
	U32 crcVal;
	crcVal = calculateCRC (argv[1], dStrlen(argv[1]), -1);
	crcVal = (crcVal*-1)-1;
	return(S32(crcVal));
}


It allows you to use the command line
%hash = getStringCRC("bla");

The hash that is returned is compatible with php CRC32 so will be very handy when integrating into your auth/web servers.

#1
02/03/2002 (8:04 am)
That's pretty interesting.
#2
07/13/2008 (9:01 pm)
Very useful!