\section{KMD4 Class Reference}
\label{classKMD4}\index{KMD4@{KMD4}}
An adapted C++ implementation of the MD4 Message-Digest algorithm. \begin{Desc}
\item[Since:]3.4. \end{Desc}
 


{\tt \#include $<$kmdcodec.h$>$}

\subsection*{Public Types}
\begin{CompactItemize}
\item 
typedef unsigned char {\bf Digest} [16]\label{classKMD4_w0}

\end{CompactItemize}
\subsection*{Public Member Functions}
\begin{CompactItemize}
\item 
{\bf KMD4} (const char $\ast$in, int len=-1)
\item 
{\bf KMD4} (const {\bf QByte\-Array} \&a)
\item 
{\bf KMD4} (const {\bf QCString} \&a)
\item 
void {\bf update} (const char $\ast$in, int len=-1)
\item 
void {\bf update} (const unsigned char $\ast$in, int len=-1)
\item 
void {\bf update} (const {\bf QByte\-Array} \&in)
\item 
void {\bf update} (const {\bf QCString} \&in)
\item 
bool {\bf update} ({\bf QIODevice} \&file)
\item 
void {\bf reset} ()
\item 
const Digest \& {\bf raw\-Digest} ()
\item 
void {\bf raw\-Digest} (KMD4::Digest \&bin)
\item 
{\bf QCString} {\bf hex\-Digest} ()
\item 
void {\bf hex\-Digest} ({\bf QCString} \&)
\item 
{\bf QCString} {\bf base64Digest} ()
\item 
bool {\bf verify} (const KMD4::Digest \&digest)
\item 
bool {\bf verify} (const {\bf QCString} \&)
\end{CompactItemize}
\subsection*{Protected Member Functions}
\begin{CompactItemize}
\item 
void {\bf transform} (Q\_\-UINT32 buf[4], Q\_\-UINT32 const in[16])
\item 
void {\bf finalize} ()
\end{CompactItemize}


\subsection{Detailed Description}
An adapted C++ implementation of the MD4 Message-Digest algorithm. \begin{Desc}
\item[Since:]3.4. \end{Desc}


The class usage is the same as {\bf KMD5}{\rm (p.\,\pageref{classKMD5})}. 



Definition at line 577 of file kmdcodec.h.

\subsection{Constructor \& Destructor Documentation}
\index{KMD4@{KMD4}!KMD4@{KMD4}}
\index{KMD4@{KMD4}!KMD4@{KMD4}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}KMD4::KMD4 (const char $\ast$ {\em in}, int {\em len} = {\tt -1})}\label{classKMD4_a1}


Constructor that updates the digest for the given string. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em in}]C string or binary data \item[{\em len}]if negative, calculates the length by using strlen on the first parameter, otherwise it trusts the given length (does not stop on NUL byte). \end{description}
\end{Desc}


Definition at line 1145 of file kmdcodec.cpp.

References update().\index{KMD4@{KMD4}!KMD4@{KMD4}}
\index{KMD4@{KMD4}!KMD4@{KMD4}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}KMD4::KMD4 (const {\bf QByte\-Array} \& {\em a})}\label{classKMD4_a2}


This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Same as above except it accepts a {\bf QByte\-Array} as its argument. 

Definition at line 1151 of file kmdcodec.cpp.

References update().\index{KMD4@{KMD4}!KMD4@{KMD4}}
\index{KMD4@{KMD4}!KMD4@{KMD4}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}KMD4::KMD4 (const {\bf QCString} \& {\em a})}\label{classKMD4_a3}


This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Same as above except it accepts a {\bf QCString} as its argument. 

Definition at line 1157 of file kmdcodec.cpp.

References update().

\subsection{Member Function Documentation}
\index{KMD4@{KMD4}!update@{update}}
\index{update@{update}!KMD4@{KMD4}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void KMD4::update (const char $\ast$ {\em in}, int {\em len} = {\tt -1})\hspace{0.3cm}{\tt  [inline]}}\label{classKMD4_a4}


Updates the message to be digested. 

Be sure to add all data before you read the digest. After reading the digest, you can {\bf not} add more data!

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em in}]message to be added to digest \item[{\em len}]the length of the given message. \end{description}
\end{Desc}


Definition at line 617 of file kmdcodec.h.

Referenced by KMD4(), and update().\index{KMD4@{KMD4}!update@{update}}
\index{update@{update}!KMD4@{KMD4}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void KMD4::update (const unsigned char $\ast$ {\em in}, int {\em len} = {\tt -1})}\label{classKMD4_a5}


This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. 

Definition at line 1177 of file kmdcodec.cpp.

References endl(), and transform().\index{KMD4@{KMD4}!update@{update}}
\index{update@{update}!KMD4@{KMD4}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void KMD4::update (const {\bf QByte\-Array} \& {\em in})}\label{classKMD4_a6}


This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em in}]message to be added to the digest ({\bf QByte\-Array}). \end{description}
\end{Desc}


Definition at line 1163 of file kmdcodec.cpp.

References update().\index{KMD4@{KMD4}!update@{update}}
\index{update@{update}!KMD4@{KMD4}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void KMD4::update (const {\bf QCString} \& {\em in})}\label{classKMD4_a7}


This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em in}]message to be added to the digest ({\bf QCString}). \end{description}
\end{Desc}


Definition at line 1168 of file kmdcodec.cpp.

References update().\index{KMD4@{KMD4}!update@{update}}
\index{update@{update}!KMD4@{KMD4}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}bool KMD4::update ({\bf QIODevice} \& {\em file})}\label{classKMD4_a8}


This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

reads the data from an I/O device, i.e. from a file ({\bf QFile}).

NOTE that the file must be open for reading.

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em file}]a pointer to FILE as returned by calls like f\{d,re\}open\end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]false if an error occurred during reading. \end{Desc}


Definition at line 1235 of file kmdcodec.cpp.

References update().\index{KMD4@{KMD4}!reset@{reset}}
\index{reset@{reset}!KMD4@{KMD4}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void KMD4::reset ()}\label{classKMD4_a9}


Calling this function will reset the calculated message digest. 

Use this method to perform another message digest calculation without recreating the KMD4 object. 

Definition at line 1364 of file kmdcodec.cpp.\index{KMD4@{KMD4}!rawDigest@{rawDigest}}
\index{rawDigest@{rawDigest}!KMD4@{KMD4}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}const KMD4::Digest \& KMD4::raw\-Digest ()}\label{classKMD4_a10}


\begin{Desc}
\item[Returns:]the raw representation of the digest \end{Desc}


Definition at line 1309 of file kmdcodec.cpp.

References finalize().

Referenced by verify().\index{KMD4@{KMD4}!rawDigest@{rawDigest}}
\index{rawDigest@{rawDigest}!KMD4@{KMD4}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void KMD4::raw\-Digest (KMD4::Digest \& {\em bin})}\label{classKMD4_a11}


Fills the given array with the binary representation of the message digest. 

Use this method if you do not want to worry about making copy of the digest once you obtain it.

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em bin}]an array of 16 characters ( char[16] ) \end{description}
\end{Desc}


Definition at line 1315 of file kmdcodec.cpp.

References finalize().\index{KMD4@{KMD4}!hexDigest@{hexDigest}}
\index{hexDigest@{hexDigest}!KMD4@{KMD4}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf QCString} KMD4::hex\-Digest ()}\label{classKMD4_a12}


Returns the value of the calculated message digest in a hexadecimal representation. 



Definition at line 1321 of file kmdcodec.cpp.

References finalize().

Referenced by verify().\index{KMD4@{KMD4}!hexDigest@{hexDigest}}
\index{hexDigest@{hexDigest}!KMD4@{KMD4}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void KMD4::hex\-Digest ({\bf QCString} \&)}\label{classKMD4_a13}


This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. 

Definition at line 1334 of file kmdcodec.cpp.

References finalize(), and QCString::resize().\index{KMD4@{KMD4}!base64Digest@{base64Digest}}
\index{base64Digest@{base64Digest}!KMD4@{KMD4}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf QCString} KMD4::base64Digest ()}\label{classKMD4_a14}


Returns the value of the calculated message digest in a base64-encoded representation. 



Definition at line 1344 of file kmdcodec.cpp.

References KCodecs::base64Encode(), and finalize().\index{KMD4@{KMD4}!verify@{verify}}
\index{verify@{verify}!KMD4@{KMD4}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}bool KMD4::verify (const KMD4::Digest \& {\em digest})}\label{classKMD4_a15}


returns true if the calculated digest for the given message matches the given one. 



Definition at line 1297 of file kmdcodec.cpp.

References finalize(), and raw\-Digest().\index{KMD4@{KMD4}!verify@{verify}}
\index{verify@{verify}!KMD4@{KMD4}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}bool KMD4::verify (const {\bf QCString} \&)}\label{classKMD4_a16}


This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. 

Definition at line 1303 of file kmdcodec.cpp.

References finalize(), and hex\-Digest().\index{KMD4@{KMD4}!transform@{transform}}
\index{transform@{transform}!KMD4@{KMD4}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void KMD4::transform (Q\_\-UINT32 {\em buf}[4], Q\_\-UINT32 const  {\em in}[16])\hspace{0.3cm}{\tt  [protected]}}\label{classKMD4_b0}


Performs the real update work. 

Note that length is implied to be 64. 

Definition at line 1439 of file kmdcodec.cpp.

Referenced by finalize(), and update().\index{KMD4@{KMD4}!finalize@{finalize}}
\index{finalize@{finalize}!KMD4@{KMD4}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void KMD4::finalize ()\hspace{0.3cm}{\tt  [protected]}}\label{classKMD4_b1}


finalizes the digest 



Definition at line 1250 of file kmdcodec.cpp.

References transform().

Referenced by base64Digest(), hex\-Digest(), raw\-Digest(), and verify().

The documentation for this class was generated from the following files:\begin{CompactItemize}
\item 
kmdcodec.h\item 
kmdcodec.cpp\end{CompactItemize}
