All pastes #910260 Raw Edit

Stuff

public text v1 · immutable
·published 2008-02-19 20:59 UTC
rendered paste body
#include <iostream>
#include <string>
#include <stdlib.h>
using namespace std;
string hashstream;
int hasha = 0;
int hashb = 0;

int RSHash(string hashstream, int a, int b)
{
	int hash = 0;
	int i;
	for(i = 0; i < hashstream.length(); i++)
	{
		hash = hash * a + hashstream[i];
		a = a * b;
	}

   return (hash & 0x7FFFFFFF); 
}

int main (int argc, char * const argv[]) 
{
		hashstream = argv[1];
		hasha = atoi(argv[2]);
		hashb = atoi(argv[3]);
		std::cout<<RSHash(hashstream, hasha, hashb) << "\n";
    return 0;
}
/* update test */