Back to index

glibc  2.9
Functions
des_crypt.h File Reference
#include <sunrpc/rpc/des_crypt.h>

Go to the source code of this file.

Functions

int xencrypt (char *secret, char *passwd)
int xdecrypt (char *secret, char *passwd)

Function Documentation

int xdecrypt ( char *  secret,
char *  passwd 
)

Definition at line 139 of file xcrypt.c.

{
  char key[8];
  char ivec[8];
  char *buf;
  int err;
  int len;

  len = strlen (secret) / 2;
  buf = malloc ((unsigned) len);

  hex2bin (len, secret, buf);
  passwd2des_internal (passwd, key);
  memset (ivec, 0, 8);

  err = cbc_crypt (key, buf, len, DES_DECRYPT | DES_HW, ivec);
  if (DES_FAILED (err))
    {
      free (buf);
      return 0;
    }
  bin2hex (len, (unsigned char *) buf, secret);
  free (buf);
  return 1;
}

Here is the caller graph for this function:

int xencrypt ( char *  secret,
char *  passwd 
)

Definition at line 108 of file xcrypt.c.

{
  char key[8];
  char ivec[8];
  char *buf;
  int err;
  int len;

  len = strlen (secret) / 2;
  buf = malloc ((unsigned) len);
  hex2bin (len, secret, buf);
  passwd2des_internal (passwd, key);
  memset (ivec, 0, 8);

  err = cbc_crypt (key, buf, len, DES_ENCRYPT | DES_HW, ivec);
  if (DES_FAILED (err))
    {
      free (buf);
      return 0;
    }
  bin2hex (len, (unsigned char *) buf, secret);
  free (buf);
  return 1;
}

Here is the call graph for this function: