Previous     Contents     Index     Next     
Setup Util Programmer's Guide



Chapter 23   Code.h Library Reference


This chapter describes code.h, the library containing encryption and decryption functions. It contains the following sections:



Definitions

The code.h library contains these definitions.


SHA1_LENGTH

Number of bytes a SHA-1 hash produces

#define SHA1_LENGTH            20


BASE64_LEN

Estimates the length of a base64 encoded string

#define BASE64_LEN(vlen)       (((vlen) * 4 / 3 ) + 3)



Functions

The code.h library contains these functions.


SHA1_Hash

The SHA-1 secure hash function. Hashes a null terminated character string "src" into "dest" using SHA-1.

static int SHA1_Hash(unsigned char *dest, char *src);


SHA1_HashBuf

Hashes a non-null terminated string "src" into "dest" using SHA-1.

static int SHA1_HashBuf(unsigned char *dest, unsigned char *src,

                        unsigned int src_length);


base64_decode

Decodes a base64 encoded string.

NSAPI_EXTERN int base64_decode( char *src, unsigned char *dst );


base64_encode

Encodes a string into base64.

NSAPI_EXTERN int base64_encode( unsigned char *src, char *dst, int                                 srclen, int lenused );


sha1_pw_enc

Encodes a password using SHA-1 encryption.

NSAPI_EXTERN char *sha1_pw_enc( char *pwd );


sha1_pw_cmp

Performs a comparison operation on a SHA-1 encrypted password.

NSAPI_EXTERN int sha1_pw_cmp( char *userpwd, char *dbpwd );


Previous     Contents     Index     Next     
Copyright (C) 2005 Red Hat, Inc. All rights reserved.
This material may be distributed only subject to the terms and conditions set forth in the Open Publication License, v1.0 or later (the latest version is presently available at http://www.opencontent.org/openpub/

Last Updated April 11, 2000