File: simplecrypt.c

package info (click to toggle)
cucipop 1.31-5
  • links: PTS
  • area: non-free
  • in suites: slink
  • size: 236 kB
  • ctags: 379
  • sloc: ansic: 2,260; sh: 148; makefile: 92
file content (26 lines) | stat: -rw-r--r-- 747 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
/************************************************************************
 *	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;
   }
}