File: gcin-crypt.cpp

package info (click to toggle)
gcin 2.9.4%2Bdfsg1-4
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 21,796 kB
  • sloc: cpp: 34,326; ansic: 9,319; makefile: 658; sh: 556
file content (19 lines) | stat: -rw-r--r-- 369 bytes parent folder | download | duplicates (10)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#include "gcin-protocol.h"

static int __gcin_rand__(u_int *next)
{
  *next = *next * 1103515245 + 12345;
  return((unsigned)(*next/65536) % 32768);
}

void __gcin_enc_mem(u_char *p, int n,
                    GCIN_PASSWD *passwd, u_int *seed)
{
  int i;

  for(i=0; i < n; i++) {
    int v = __gcin_rand__(seed) % __GCIN_PASSWD_N_;
    p[i]^=passwd->passwd[v];
  }
}