Mass++ Common Libraries v2.7.5
 All Classes Namespaces Files Functions Variables Enumerations Macros
Public Member Functions | Public Attributes | Protected Member Functions | List of all members
kome::core::Sha1::Sha1Context Class Reference

SHA1 context. More...

#include <Sha1.h>

Public Member Functions

 Sha1Context ()
 constructor
 
virtual ~Sha1Context ()
 destructor
 
void appendMessage (unsigned char *msg, const unsigned long length)
 appends message More...
 
void finish ()
 finishes to append message
 
void reset ()
 resets member variables
 

Public Attributes

unsigned long m_h [5]
 
unsigned char m_block [64]
 
unsigned long m_length
 
unsigned long m_pos
 

Protected Member Functions

void updateHash ()
 updates hash
 
void padBlock ()
 pads block
 

Detailed Description

SHA1 context.

Definition at line 66 of file Sha1.h.

Member Function Documentation

void kome::core::Sha1::Sha1Context::appendMessage ( unsigned char *  msg,
const unsigned long  length 
)

appends message

Parameters
[in]msgthe pointer to the message
[in]lengthmessage length

Definition at line 130 of file Sha1.cpp.

130  {
131  // check the parameter
132  if( length == 0 ) {
133  return;
134  }
135 
136  // set to the block
137  for( unsigned int i = 0; i < length; i++ ) {
138  m_block[ m_pos++ ] = msg[ i ];
139  // set to block
140  m_length++;
141 
142  // update hash
143  if( m_pos == 64 ) {
144  updateHash();
145  m_pos = 0;
146  fillzero( m_block, sizeof( m_block ) );
147  }
148  }
149 }
unsigned char m_block[64]
Definition: Sha1.h:112
unsigned long m_pos
Definition: Sha1.h:118
unsigned long m_length
Definition: Sha1.h:115
void updateHash()
updates hash
Definition: Sha1.cpp:161
void fillzero(void *p, size_t n)
This function fills a block of memory zeros.

Here is the call graph for this function:

Member Data Documentation

unsigned char kome::core::Sha1::Sha1Context::m_block[64]

block

Definition at line 112 of file Sha1.h.

unsigned long kome::core::Sha1::Sha1Context::m_h[5]

intermediate hash

Definition at line 109 of file Sha1.h.

unsigned long kome::core::Sha1::Sha1Context::m_length

length

Definition at line 115 of file Sha1.h.

unsigned long kome::core::Sha1::Sha1Context::m_pos

position

Definition at line 118 of file Sha1.h.


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