×
Namespaces

Variants
Actions

Libcrypt

From Nokia Developer Wiki
Jump to: navigation, search
Article Metadata
Article
Created: spark55 (20 Sep 2007)
Last edited: hamishwillee (27 Jul 2012)

Introduction

libcrypt is used for encrypting/decrypting of messages,passwords and blocks of data.

Functions

The main cryptographic functions in this lib are:

  • setkey
    • An utility which adds, updates, dumps, or flushes Security Association Database (SAD) entries as well as Security Policy Database (SPD) entries in the kernel.
  • encrypt
    • encrypt() function encrypts and decrypts64-bit messages. The algorithm used to perform encryption/decryption is Data Encryption Standard (DES).
    • The encrypt and setkey functions do not return any value.
    • setkey() is invoked to set the key for the DES machine.
    • If encrypt is called without priorly invoking setkey the implementation assumes a bit vector consisting of all zeroes as the key for the DES algorithm.
#include <unistd.h>  
void encrypt (char datablock[64], int flag);
 
#include <stdlib.h>
void setkey (const char *key);
  • crypt
    • The crypt function performs password hashing.
    • The crypt function returns a pointer to the encrypted value on success, and NULL on failure.
    • Currently the implementation supports Data Encryption Standard (DES) and MD5 hash algorithms
  #include <unistd.h>  
char * crypt (const char *key, const char *salt);


Links

This page was last modified on 27 July 2012, at 07:32.
78 page views in the last 30 days.
×