general/misc.cc File Reference

#include "misc.h"
#include "gcrypt.h"
#include <sstream>
#include "log.h"

Defines

#define DEBUG_ROUTINE   "misc"

Functions

std::string hash (std::string str)
 Calculate a sha1 hash value from a string. The result is a hexadecimal 40 tokens number.
std::string subs (std::string s, size_t from, size_t len)
std::string derived (std::string session, int sessnr)
 Find a derived hash from a session string that protects to real session string from observers.

Variables

const char hex_tbl [] = "0123456789abcdef"

Define Documentation

#define DEBUG_ROUTINE   "misc"


Function Documentation

std::string derived ( std::string  session,
int  sessnr 
)

Find a derived hash from a session string that protects to real session string from observers.

Parameters:
session  session string in need of protection
sessnr  number that increases every communication session

std::string hash ( std::string  str  ) 

Calculate a sha1 hash value from a string. The result is a hexadecimal 40 tokens number.

Parameters:
str  Base string from where the hash value is calculated

std::string subs ( std::string  s,
size_t  from,
size_t  len 
)


Variable Documentation

const char hex_tbl[] = "0123456789abcdef"



Generated on Tue Jan 1 17:30:01 2008 for general/misc.cc File Reference by  doxygen   Visit the project page on SourceForge.net Logo