sha1.h File Reference


Detailed Description

This is the header file for code which implements the Secure Hashing Algorithm 1 as defined in FIPS PUB 180-1 published April 17, 1995.

Many of the variable names in this code, especially the single character names, were used because those were the names used in the publication.

Id
sha1.h,v 1.4 2003/10/20 16:10:17 lecroart Exp

Definition in file sha1.h.

#include <string>
#include "nel/misc/common.h"
#include "nel/misc/stream.h"

Go to the source code of this file.

Data Structures

struct  CHashKey

Functions

CHashKey getSHA1 (const uint8 *buffer, uint32 size)
CHashKey getSHA1 (const std::string &filename)
bool operator< (const struct CHashKey &a, const struct CHashKey &b)


Function Documentation

CHashKey getSHA1 const uint8 buffer,
uint32  size
 

Definition at line 139 of file sha1.cpp.

References buffer, nlwarning, SHA1Input(), SHA1Reset(), SHA1Result(), size, uint32, uint8, and uint8_t.

00140 {
00141     SHA1Context sha;
00142     int err;
00143     uint8_t Message_Digest[20];
00144         
00145         err = SHA1Reset(&sha);
00146         if (err)
00147         {
00148                 nlwarning("SHA: SHA1Reset Error %d.\n", err );
00149                 return CHashKey();
00150         }
00151         
00152         err = SHA1Input(&sha, (const uint8_t*)buffer, size);
00153         if (err)
00154         {
00155                 nlwarning ("SHA: SHA1Input Error %d.\n", err);
00156                 return CHashKey();
00157         }
00158         
00159         err = SHA1Result(&sha, Message_Digest);
00160         if (err)
00161         {
00162                 nlwarning("SHA: SHA1Result Error %d, could not compute message digest.\n", err );
00163                 return CHashKey();
00164         }
00165         
00166         CHashKey hk (Message_Digest);
00167         return hk;
00168 }       

CHashKey getSHA1 const std::string &  filename  ) 
 

bool operator< const struct CHashKey a,
const struct CHashKey b
[inline]
 

Definition at line 112 of file sha1.h.

References CHashKey::HashKeyString.

Referenced by NLAIAGENT::CAgentNumber::operator<().

00113 {
00114         return a.HashKeyString<b.HashKeyString;
00115 }


Generated on Tue Mar 16 06:43:17 2004 for NeL by doxygen 1.3.6