Public Member Functions | Private Attributes

cmn_ParityHash Class Reference

#include <cmn_hash.h>

Inheritance diagram for cmn_ParityHash:
Inheritance graph
[legend]
Collaboration diagram for cmn_ParityHash:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 cmn_ParityHash ()
virtual ~cmn_ParityHash ()
void Update (char *a_buffer, ivd_FileBufSize_t a_size)

Private Attributes

 log_CLASSID_m
ivd_FileBufSize_t m_hashSize

Detailed Description

Definition at line 64 of file cmn_hash.h.


Constructor & Destructor Documentation

cmn_ParityHash::cmn_ParityHash (  ) 

Definition at line 76 of file cmn_hash.cpp.

References log_FUNC_m, cmn_Hash::m_hash, and cmn_Hash_t::ui64.

    :m_hashSize(CMN_HASH_ELEMENTS_d * 8){
    log_FUNC_m(cmn_ParityHash);
    for( int i=0; i < CMN_HASH_ELEMENTS_d; i++ ){
        m_hash.ui64[i] = 0;
    }
}

cmn_ParityHash::~cmn_ParityHash (  )  [virtual]

Definition at line 84 of file cmn_hash.cpp.

References log_FUNC_m.

                               {
    log_FUNC_m(~cmn_Parityhash);
}


Member Function Documentation

void cmn_ParityHash::Update ( char *  a_buffer,
ivd_FileBufSize_t  a_size 
)

Definition at line 88 of file cmn_hash.cpp.

References cmn_Hash_t::c, log_FUNC_m, cmn_Hash::m_available, cmn_Hash::m_hash, m_hashSize, and cmn_Hash_t::ui64.

                                                                    {
    log_FUNC_m(Update);
    size_t rest = a_size;
    union cmn_Hash_t *p((union cmn_Hash_t *) a_buffer);   
    while(rest >= m_hashSize){
        for(int i=0; i< CMN_HASH_ELEMENTS_d; i++){
            m_hash.ui64[i] ^= p->ui64[i];
        }
        rest -= m_hashSize;
        p++;
    }
    //  now pad the remainig bytes with zeros
    for (size_t i=0; i<m_hashSize; i++){
        if(i < rest){
           m_hash.c[i] ^= p->c[i];
        }
        else{
           m_hash.c[i] ^= 0;
        }
    }
    m_available = true;
}


Member Data Documentation

Reimplemented from cmn_Hash.

Definition at line 71 of file cmn_hash.h.

Definition at line 72 of file cmn_hash.h.

Referenced by Update().


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