Hi everyone,
I would like to add a new function to my PHP installation.
The C source in question can be found at http://www.clickbank.com/crypto.html
Has anyone ever added a "custom made" function to PHP ?
This is the C function i would like to add:
C SOURCE:
int valid(char arg_seed, char arg_cbpop, char secret_key)
// - Pass seed, cbpop, and your key as strings.
// - Function returns 0 or 1.
{
// Copyright Keynetics Inc. Patents pending.
char a[100], w[100], q[9];
char charsmask = "0123456789BCDEFGHJKLMNPQRSTVWXYZ";
char *p;
unsigned long int h, l, i, wi, x, y, z, n, s[10];
if (!strcmp(arg_seed, "")) { return 0; }
if (!strcmp(arg_cbpop, "")) { return 0; }
h=0x80000000; l=0x7fffffff; strcpy(q, "");
sprintf(w,"%s %s",secret_key,arg_seed);
p=w; while(*p){*p=toupper(*p);p++;}
x=y=z=17; n=strlen(w);
for(i=0;i<10;i++){s[i]=0;}
for(i=0;i<256;i++)
{ wi=((x&l)+(y&l))^((x^y)&h);
wi=(wi<<z)|(wi>>(32-z));
wi=((wi&l)+w[i%n])^(wi&h);
s[i&7]+=wi&31;
z=y&31; y=x; x=wi;
}
for (i=0; i < 8; i++) { q[i] = charsmask[s[i] & 31]; }
q[8] = '';
if (!strcmp(arg_cbpop, q)) { return 1; }
else { return 0; }
}--------------------------------------------------------------------------------
On success, the function returns 1
On failure, the function returns 0 or nothing.
Any ideas on how to get started or add this function ?
Thanks
Marcel Pamphile