/************************************************************************
* Routine to perform a simplistic encryption *
* *
* Copyright (c) 1998, S.R. van den Berg, The Netherlands *
* #include "README" *
************************************************************************/
#ifdef RCS
static /*const*/char rcsid[]=
"$Id: simplecrypt.c,v 1.1 1998/05/13 16:57:40 srb Exp $";
#endif
#include <sys/types.h>
#include "sdb.h"
#include "simplecrypt.h"
void scmorph(DBT*k,DBT*d)
{ unsigned long state;const unsigned char*seed;unsigned char*target;
size_t dlen,klen;
state=(dlen=d->size)*(klen=k->size);
for(seed=k->data,target=d->data;dlen--;)
{ if(klen)
klen--,state+=*seed++;
*target^=state*=67076L;
}
}
syntax highlighted by Code2HTML, v. 0.9.1