Namespaces

Variants
Actions

Please note that as of October 24, 2014, the Nokia Developer Wiki will no longer be accepting user contributions, including new entries, edits and comments, as we begin transitioning to our new home, in the Windows Phone Development Wiki. We plan to move over the majority of the existing entries over the next few weeks. Thanks for all your past and future contributions.

Libcrypt

From 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 04:32.
91 page views in the last 30 days.

Was this page helpful?

Your feedback about this content is important. Let us know what you think.

 

Thank you!

We appreciate your feedback.

×