SNAP Library 4.1, User Reference  2018-07-26 16:30:42
SNAP, a general purpose, high performance system for analysis and manipulation of large networks
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
TMd5Sig Class Reference

#include <md5.h>

Public Member Functions

 TMd5Sig ()
 
 TMd5Sig (const TMd5Sig &Md5Sig)
 
 TMd5Sig (const PSIn &SIn)
 
 TMd5Sig (const TStr &Str)
 
 TMd5Sig (const TChA &ChA)
 
 TMd5Sig (const char *CStr)
 
 TMd5Sig (const TMem &Mem)
 
 TMd5Sig (const TMd5 &Md5)
 
 TMd5Sig (TSIn &SIn)
 
void Save (TSOut &SOut) const
 
TMd5Sigoperator= (const TMd5Sig &Md5Sig)
 
bool operator== (const TMd5Sig &Md5Sig) const
 
bool operator< (const TMd5Sig &Md5Sig) const
 
int operator[] (const int &CdN) const
 
int GetPrimHashCd () const
 
int GetSecHashCd () const
 
TStr GetStr () const
 
void GetUInt (const int &StartCd, uint &UInt) const
 

Private Types

typedef TB1Def::TB1 uint1
 

Private Attributes

uint1 CdT [16]
 

Detailed Description

Definition at line 81 of file md5.h.

Member Typedef Documentation

typedef TB1Def::TB1 TMd5Sig::uint1
private

Definition at line 83 of file md5.h.

Constructor & Destructor Documentation

TMd5Sig::TMd5Sig ( )
inline

Definition at line 86 of file md5.h.

86 {memset(CdT, 0, 16);}
uint1 CdT[16]
Definition: md5.h:84
TMd5Sig::TMd5Sig ( const TMd5Sig Md5Sig)
inline

Definition at line 87 of file md5.h.

87 {memcpy(CdT, Md5Sig.CdT, 16);}
uint1 CdT[16]
Definition: md5.h:84
TMd5Sig::TMd5Sig ( const PSIn SIn)

Definition at line 239 of file md5.cpp.

239  {
240  PMd5 Md5=TMd5::New(SIn);
241  memcpy(CdT, Md5->Sig, 16);
242 }
uint1 CdT[16]
Definition: md5.h:84
static PMd5 New()
Definition: md5.h:49
Definition: bd.h:196
TMd5Sig::TMd5Sig ( const TStr Str)

Definition at line 244 of file md5.cpp.

244  {
245  PMd5 Md5=TMd5::New(TStrIn::New(Str));
246  memcpy(CdT, Md5->Sig, 16);
247 }
uint1 CdT[16]
Definition: md5.h:84
static PMd5 New()
Definition: md5.h:49
static PSIn New(const TStr &Str)
Definition: dt.h:708
Definition: bd.h:196
TMd5Sig::TMd5Sig ( const TChA ChA)

Definition at line 249 of file md5.cpp.

249  {
250  TMd5 Md5; Md5.Add((uchar *) ChA.CStr(), ChA.Len()); Md5.Def();
251  memcpy(CdT, Md5.Sig, 16);
252 }
int Len() const
Definition: dt.h:259
uint1 CdT[16]
Definition: md5.h:84
void Add(uchar *InBf, const int &InBfL)
Definition: md5.cpp:148
Definition: md5.h:5
char * CStr()
Definition: dt.h:255
uint1 Sig[16]
Definition: md5.h:16
unsigned char uchar
Definition: bd.h:10
void Def()
Definition: md5.cpp:187
TMd5Sig::TMd5Sig ( const char *  CStr)

Definition at line 254 of file md5.cpp.

254  {
255  TMd5 Md5; Md5.Add((uchar *) CStr, (int) strlen(CStr)); Md5.Def();
256  memcpy(CdT, Md5.Sig, 16);
257 }
uint1 CdT[16]
Definition: md5.h:84
void Add(uchar *InBf, const int &InBfL)
Definition: md5.cpp:148
Definition: md5.h:5
uint1 Sig[16]
Definition: md5.h:16
unsigned char uchar
Definition: bd.h:10
void Def()
Definition: md5.cpp:187
TMd5Sig::TMd5Sig ( const TMem Mem)

Definition at line 259 of file md5.cpp.

259  {
260  PMd5 Md5=TMd5::New(TMemIn::New(Mem));
261  memcpy(CdT, Md5->Sig, 16);
262 }
static PSIn New(const TMem &Mem)
Definition: dt.h:165
uint1 CdT[16]
Definition: md5.h:84
static PMd5 New()
Definition: md5.h:49
Definition: bd.h:196
TMd5Sig::TMd5Sig ( const TMd5 Md5)
inline

Definition at line 93 of file md5.h.

93 {memcpy(CdT, Md5.Sig, 16);}
uint1 CdT[16]
Definition: md5.h:84
uint1 Sig[16]
Definition: md5.h:16
TMd5Sig::TMd5Sig ( TSIn SIn)
inline

Definition at line 94 of file md5.h.

94 {SIn.LoadBf(CdT, 16);}
uint1 CdT[16]
Definition: md5.h:84
void LoadBf(const void *Bf, const TSize &BfL)
Definition: fl.h:81

Member Function Documentation

int TMd5Sig::GetPrimHashCd ( ) const

Definition at line 264 of file md5.cpp.

264  {
265  int HashCd=0;
266  memcpy(&HashCd, &CdT[0], 4);
267  HashCd=abs(HashCd);
268  return HashCd;
269 }
uint1 CdT[16]
Definition: md5.h:84
int TMd5Sig::GetSecHashCd ( ) const

Definition at line 271 of file md5.cpp.

271  {
272  int HashCd=0;
273  memcpy(&HashCd, &CdT[3], 4);
274  HashCd=abs(HashCd);
275  return HashCd;
276 }
uint1 CdT[16]
Definition: md5.h:84
TStr TMd5Sig::GetStr ( ) const

Definition at line 278 of file md5.cpp.

278  {
279  TChA ChA(32);
280  for (int CdN=0; CdN<16; CdN++){
281  ChA+=TCh::GetHexCh(CdT[CdN]/16);
282  ChA+=TCh::GetHexCh(CdT[CdN]%16);
283  }
284  return ChA;
285 }
static char GetHexCh(const int &Val)
Definition: dt.h:1074
uint1 CdT[16]
Definition: md5.h:84
Definition: dt.h:201
void TMd5Sig::GetUInt ( const int &  StartCd,
uint UInt 
) const
inline

Definition at line 112 of file md5.h.

112  {
113  memcpy(&UInt, CdT+StartCd, sizeof(uint));}
unsigned int uint
Definition: bd.h:11
uint1 CdT[16]
Definition: md5.h:84
bool TMd5Sig::operator< ( const TMd5Sig Md5Sig) const
inline

Definition at line 101 of file md5.h.

101  {
102  return memcmp(CdT, Md5Sig.CdT, 16)==-1;}
uint1 CdT[16]
Definition: md5.h:84
TMd5Sig& TMd5Sig::operator= ( const TMd5Sig Md5Sig)
inline

Definition at line 97 of file md5.h.

97  {
98  if (this!=&Md5Sig){memcpy(CdT, Md5Sig.CdT, 16);} return *this;}
uint1 CdT[16]
Definition: md5.h:84
bool TMd5Sig::operator== ( const TMd5Sig Md5Sig) const
inline

Definition at line 99 of file md5.h.

99  {
100  return memcmp(CdT, Md5Sig.CdT, 16)==0;}
uint1 CdT[16]
Definition: md5.h:84
int TMd5Sig::operator[] ( const int &  CdN) const
inline

Definition at line 103 of file md5.h.

103  {
104  Assert((0<=CdN)&&(CdN<16)); return CdT[CdN];}
uint1 CdT[16]
Definition: md5.h:84
#define Assert(Cond)
Definition: bd.h:251
void TMd5Sig::Save ( TSOut SOut) const
inline

Definition at line 95 of file md5.h.

95 {SOut.SaveBf(CdT, 16);}
uint1 CdT[16]
Definition: md5.h:84
void SaveBf(const void *Bf, const TSize &BfL)
Definition: fl.h:172

Member Data Documentation

uint1 TMd5Sig::CdT[16]
private

Definition at line 84 of file md5.h.


The documentation for this class was generated from the following files: