\hypertarget{group__hmac__functions}{}\doxysection{H\+M\+AC Functions}
\label{group__hmac__functions}\index{HMAC Functions@{HMAC Functions}}


Qore\textquotesingle{}s cryptography support is provided by the Open\+S\+SL library.  


Collaboration diagram for H\+M\+AC Functions\+:
\nopagebreak
\begin{figure}[H]
\begin{center}
\leavevmode
\includegraphics[width=350pt]{group__hmac__functions}
\end{center}
\end{figure}
\doxysubsection*{Modules}
\begin{DoxyCompactItemize}
\item 
\mbox{\hyperlink{group__crypto__transformations}{Cryptographic Stream Transformations}}
\begin{DoxyCompactList}\small\item\em The following \mbox{\hyperlink{class_qore_1_1_transform}{Transform}} constants can be used with \mbox{\hyperlink{class_qore_1_1_transform_input_stream}{Transform\+Input\+Stream}} and \mbox{\hyperlink{class_qore_1_1_transform_output_stream}{Transform\+Output\+Stream}} to transform stream data. \end{DoxyCompactList}\item 
\mbox{\hyperlink{group__cryptographic__constants}{Cryptographic Contants}}
\begin{DoxyCompactList}\small\item\em Other generic cryptographic constants. \end{DoxyCompactList}\item 
\mbox{\hyperlink{group__digest__algorithms}{Crytographic Digest Algorithms}}
\begin{DoxyCompactList}\small\item\em The following constants can be used with the \mbox{\hyperlink{group__hmac__functions_gaefc09e78e7bccccf7bc3629e4e86c9e2}{digest()}} and \mbox{\hyperlink{group__hmac__functions_gaf88021aec5a7048984b0a0e5ce21733d}{hmac()}} functions to calculate cryptographic digests and H\+M\+A\+Cs on input data. \end{DoxyCompactList}\end{DoxyCompactItemize}
\doxysubsection*{Functions}
\begin{DoxyCompactItemize}
\item 
\mbox{\hyperlink{group__type__conversion__functions_gacf16b4126b795f4b6933ef3425cadae3}{string}} \mbox{\hyperlink{group__hmac__functions_ga3a75abdcf6815bd9c15ae55f5d8f0cc7}{Qore\+::\+D\+S\+S1\+\_\+hmac}} (data data, data key)
\begin{DoxyCompactList}\small\item\em Returns the D\+S\+S1 (S\+H\+A-\/1 and \href{http://en.wikipedia.org/wiki/Digital_Signature_Algorithm}{\texttt{ D\+SA}}) based H\+M\+AC of the supplied argument as a hex string. \end{DoxyCompactList}\item 
\mbox{\hyperlink{group__type__conversion__functions_gacf16b4126b795f4b6933ef3425cadae3}{string}} \mbox{\hyperlink{group__hmac__functions_gaca49d7d4e9a7999b7b11ffa734d98cf3}{Qore\+::\+D\+S\+S\+\_\+hmac}} (data data, data key)
\begin{DoxyCompactList}\small\item\em Returns the D\+SS (S\+H\+A-\/0 and \href{http://en.wikipedia.org/wiki/Digital_Signature_Algorithm}{\texttt{ D\+SA}}) based H\+M\+AC of the supplied argument as a hex string. \end{DoxyCompactList}\item 
\mbox{\hyperlink{group__type__conversion__functions_gacf16b4126b795f4b6933ef3425cadae3}{string}} \mbox{\hyperlink{group__hmac__functions_gaeebc2ad2c2cf99a33e42c98344fceb49}{Qore\+::\+M\+D2\+\_\+hmac}} (data data, data key)
\begin{DoxyCompactList}\small\item\em Returns the \href{http://en.wikipedia.org/wiki/MD2_(cryptography)}{\texttt{ M\+D2}} based H\+M\+AC of the supplied argument as a hex string. \end{DoxyCompactList}\item 
\mbox{\hyperlink{group__type__conversion__functions_gacf16b4126b795f4b6933ef3425cadae3}{string}} \mbox{\hyperlink{group__hmac__functions_gaa1f5781d25e14ad544f76db36111e1f3}{Qore\+::\+M\+D4\+\_\+hmac}} (data data, data key)
\begin{DoxyCompactList}\small\item\em Returns the \href{http://en.wikipedia.org/wiki/MD4}{\texttt{ M\+D4}} based H\+M\+AC of the supplied argument as a hex string. \end{DoxyCompactList}\item 
\mbox{\hyperlink{group__type__conversion__functions_gacf16b4126b795f4b6933ef3425cadae3}{string}} \mbox{\hyperlink{group__hmac__functions_gac4dc67bcb217ae04c43a9df9d14d0a85}{Qore\+::\+M\+D5\+\_\+hmac}} (data data, data key)
\begin{DoxyCompactList}\small\item\em Returns the \href{http://en.wikipedia.org/wiki/MD5}{\texttt{ M\+D5}} based H\+M\+AC of the supplied argument as a hex string. \end{DoxyCompactList}\item 
\mbox{\hyperlink{group__type__conversion__functions_gacf16b4126b795f4b6933ef3425cadae3}{string}} \mbox{\hyperlink{group__hmac__functions_ga2839943cdcce18a3e5ef63ac5c728eb2}{Qore\+::\+M\+D\+C2\+\_\+hmac}} (data data, data key)
\begin{DoxyCompactList}\small\item\em Returns the \href{http://en.wikipedia.org/wiki/MDC2}{\texttt{ M\+D\+C2}} based H\+M\+AC of the supplied argument as a hex string. \end{DoxyCompactList}\item 
\mbox{\hyperlink{group__type__conversion__functions_gacf16b4126b795f4b6933ef3425cadae3}{string}} \mbox{\hyperlink{group__hmac__functions_gadecee6c469e1b4dade49924bd68c7ae4}{Qore\+::\+R\+I\+P\+E\+M\+D160\+\_\+hmac}} (data data, data key)
\begin{DoxyCompactList}\small\item\em Returns the \href{http://en.wikipedia.org/wiki/RIPEMD}{\texttt{ R\+I\+P\+E\+MD}} based H\+M\+AC of the supplied argument as a hex string. \end{DoxyCompactList}\item 
\mbox{\hyperlink{group__type__conversion__functions_gacf16b4126b795f4b6933ef3425cadae3}{string}} \mbox{\hyperlink{group__hmac__functions_gaf76d63347ffb70de4202a771ad767e2d}{Qore\+::\+S\+H\+A1\+\_\+hmac}} (data data, data key)
\begin{DoxyCompactList}\small\item\em Returns the \href{http://en.wikipedia.org/wiki/Secure_Hash_Algorithm}{\texttt{ S\+H\+A1}} based H\+M\+AC of the supplied argument as a hex string. \end{DoxyCompactList}\item 
\mbox{\hyperlink{group__type__conversion__functions_gacf16b4126b795f4b6933ef3425cadae3}{string}} \mbox{\hyperlink{group__hmac__functions_gaf78d06e41607133b0c053a544b2e92b7}{Qore\+::\+S\+H\+A224\+\_\+hmac}} (data data, data key)
\begin{DoxyCompactList}\small\item\em Returns the \href{http://en.wikipedia.org/wiki/Secure_Hash_Algorithm}{\texttt{ S\+H\+A224}} based H\+M\+AC of the supplied argument as a hex string. \end{DoxyCompactList}\item 
\mbox{\hyperlink{group__type__conversion__functions_gacf16b4126b795f4b6933ef3425cadae3}{string}} \mbox{\hyperlink{group__hmac__functions_gaf8c329f83b4b31f2e88b5342d487480b}{Qore\+::\+S\+H\+A256\+\_\+hmac}} (data data, data key)
\begin{DoxyCompactList}\small\item\em Returns the \href{http://en.wikipedia.org/wiki/Secure_Hash_Algorithm}{\texttt{ S\+H\+A256}} based H\+M\+AC of the supplied argument as a hex string. \end{DoxyCompactList}\item 
\mbox{\hyperlink{group__type__conversion__functions_gacf16b4126b795f4b6933ef3425cadae3}{string}} \mbox{\hyperlink{group__hmac__functions_gac028eb1719043ec2461239a0c1de2654}{Qore\+::\+S\+H\+A384\+\_\+hmac}} (data data, data key)
\begin{DoxyCompactList}\small\item\em Returns the \href{http://en.wikipedia.org/wiki/Secure_Hash_Algorithm}{\texttt{ S\+H\+A384}} based H\+M\+AC of the supplied argument as a hex string. \end{DoxyCompactList}\item 
\mbox{\hyperlink{group__type__conversion__functions_gacf16b4126b795f4b6933ef3425cadae3}{string}} \mbox{\hyperlink{group__hmac__functions_ga492a23df5cb989d296c96a2076ef6f8f}{Qore\+::\+S\+H\+A512\+\_\+hmac}} (data data, data key)
\begin{DoxyCompactList}\small\item\em Returns the \href{http://en.wikipedia.org/wiki/Secure_Hash_Algorithm}{\texttt{ S\+H\+A512}} based H\+M\+AC of the supplied argument as a hex string. \end{DoxyCompactList}\item 
\mbox{\hyperlink{group__type__conversion__functions_gacf16b4126b795f4b6933ef3425cadae3}{string}} \mbox{\hyperlink{group__hmac__functions_gac5ffb694353caa752b069e7b6d018fca}{Qore\+::\+S\+H\+A\+\_\+hmac}} (data data, data key)
\begin{DoxyCompactList}\small\item\em Returns the \href{http://en.wikipedia.org/wiki/Secure_Hash_Algorithm}{\texttt{ S\+HA}} based H\+M\+AC of the supplied argument as a hex string. \end{DoxyCompactList}\item 
\mbox{\hyperlink{group__type__conversion__functions_gaf11c7f5c43ced1e9b95bd2270ee87ed9}{binary}} \mbox{\hyperlink{group__hmac__functions_gad159aa97f0f07e827e74b4b9a12b92ca}{Qore\+::decrypt\+\_\+to\+\_\+binary}} (\mbox{\hyperlink{group__type__conversion__functions_gacf16b4126b795f4b6933ef3425cadae3}{string}} alg, data data, data key, data iv=\mbox{\hyperlink{group__cryptographic__constants_ga3e258a2c4d9e99eb43a97e7bf1dbe870}{Qore\+::\+Default\+IV}}, \+\_\+\+\_\+7\+\_\+ data mac, \+\_\+\+\_\+7\+\_\+ data aad)
\begin{DoxyCompactList}\small\item\em Returns a binary value of decrypted data corresponding to the input arguments inluding the given \mbox{\hyperlink{group__crypto__transformations}{algorithm}}. \end{DoxyCompactList}\item 
\mbox{\hyperlink{group__type__conversion__functions_gacf16b4126b795f4b6933ef3425cadae3}{string}} \mbox{\hyperlink{group__hmac__functions_ga94bc9698c368c32987d7207096806df1}{Qore\+::decrypt\+\_\+to\+\_\+string}} (\mbox{\hyperlink{group__type__conversion__functions_gacf16b4126b795f4b6933ef3425cadae3}{string}} alg, data data, data key, data iv=\mbox{\hyperlink{group__cryptographic__constants_ga3e258a2c4d9e99eb43a97e7bf1dbe870}{Qore\+::\+Default\+IV}}, \+\_\+\+\_\+7\+\_\+ data mac, \+\_\+\+\_\+7\+\_\+ data aad, \+\_\+\+\_\+7\+\_\+ \mbox{\hyperlink{group__type__conversion__functions_gacf16b4126b795f4b6933ef3425cadae3}{string}} encoding)
\begin{DoxyCompactList}\small\item\em Returns a string of decrypted data corresponding to the input arguments inluding the given \mbox{\hyperlink{group__crypto__transformations}{algorithm}}. \end{DoxyCompactList}\item 
\mbox{\hyperlink{group__type__conversion__functions_gaf11c7f5c43ced1e9b95bd2270ee87ed9}{binary}} \mbox{\hyperlink{group__hmac__functions_gaefc09e78e7bccccf7bc3629e4e86c9e2}{Qore\+::digest}} (\mbox{\hyperlink{group__type__conversion__functions_gacf16b4126b795f4b6933ef3425cadae3}{string}} digest, data data)
\begin{DoxyCompactList}\small\item\em Returns the digest of the supplied arguments as a binary value. \end{DoxyCompactList}\item 
\mbox{\hyperlink{group__type__conversion__functions_gaf11c7f5c43ced1e9b95bd2270ee87ed9}{binary}} \mbox{\hyperlink{group__hmac__functions_ga7141b56ffa6c5a4f8c9c58f788f33780}{Qore\+::encrypt}} (\mbox{\hyperlink{group__type__conversion__functions_gacf16b4126b795f4b6933ef3425cadae3}{string}} alg, data data, data key, data iv=\mbox{\hyperlink{group__cryptographic__constants_ga3e258a2c4d9e99eb43a97e7bf1dbe870}{Qore\+::\+Default\+IV}}, \+\_\+\+\_\+7\+\_\+ reference$<$ \mbox{\hyperlink{group__type__conversion__functions_gaf11c7f5c43ced1e9b95bd2270ee87ed9}{binary}} $>$ mac, \+\_\+\+\_\+7\+\_\+ \mbox{\hyperlink{group__type__conversion__functions_ga2de8717e92c5f97ccc6511f6062d6502}{int}} mac\+\_\+size, \+\_\+\+\_\+7\+\_\+ data aad)
\begin{DoxyCompactList}\small\item\em Returns a binary value of encrypted data corresponding to the input arguments inluding the given \mbox{\hyperlink{group__crypto__transformations}{algorithm}}. \end{DoxyCompactList}\item 
\mbox{\hyperlink{group__type__conversion__functions_ga0231dbb472dd230310af7c7c34f56e92}{hash}} \mbox{\hyperlink{group__hmac__functions_ga23662a1e7f11f483a6e841da96389197}{Qore\+::get\+\_\+crypto\+\_\+info}} ()
\begin{DoxyCompactList}\small\item\em Returns a hash of information about each cryptographic algorithmn supported by the current build of Qore. \end{DoxyCompactList}\item 
\mbox{\hyperlink{class_qore_1_1_transform}{Transform}} \mbox{\hyperlink{group__hmac__functions_ga913932d6120f9ea1e3918168fb204976}{Qore\+::get\+\_\+decryptor}} (\mbox{\hyperlink{group__type__conversion__functions_gacf16b4126b795f4b6933ef3425cadae3}{string}} alg, data key, data iv=\mbox{\hyperlink{group__cryptographic__constants_ga3e258a2c4d9e99eb43a97e7bf1dbe870}{Qore\+::\+Default\+IV}}, \+\_\+\+\_\+7\+\_\+ data mac, \+\_\+\+\_\+7\+\_\+ data aad)
\begin{DoxyCompactList}\small\item\em Returns a \mbox{\hyperlink{class_qore_1_1_transform}{Transform}} object for decrypting data using the given \mbox{\hyperlink{group__crypto__transformations}{algorithm}} for use with \mbox{\hyperlink{class_qore_1_1_transform_input_stream}{Transform\+Input\+Stream}} and \mbox{\hyperlink{class_qore_1_1_transform_output_stream}{Transform\+Output\+Stream}}. \end{DoxyCompactList}\item 
\mbox{\hyperlink{group__type__conversion__functions_ga4b52a1cbee7a3aed46c32cb0a938629c}{list}}$<$ \mbox{\hyperlink{group__type__conversion__functions_gacf16b4126b795f4b6933ef3425cadae3}{string}} $>$ \mbox{\hyperlink{group__hmac__functions_ga227c4f084f2cffee4c466989d68a1fe3}{Qore\+::get\+\_\+digests}} ()
\begin{DoxyCompactList}\small\item\em Returns a list of supported digest algorithms for \mbox{\hyperlink{group__hmac__functions_gaf88021aec5a7048984b0a0e5ce21733d}{hmac()}} \end{DoxyCompactList}\item 
\mbox{\hyperlink{class_qore_1_1_transform}{Transform}} \mbox{\hyperlink{group__hmac__functions_ga6e67ba0396d70cd012f7c46c7562b81f}{Qore\+::get\+\_\+encryptor}} (\mbox{\hyperlink{group__type__conversion__functions_gacf16b4126b795f4b6933ef3425cadae3}{string}} alg, data key, data iv=\mbox{\hyperlink{group__cryptographic__constants_ga3e258a2c4d9e99eb43a97e7bf1dbe870}{Qore\+::\+Default\+IV}}, \+\_\+\+\_\+7\+\_\+ reference$<$ \mbox{\hyperlink{group__type__conversion__functions_gaf11c7f5c43ced1e9b95bd2270ee87ed9}{binary}} $>$ mac, \+\_\+\+\_\+7\+\_\+ \mbox{\hyperlink{group__type__conversion__functions_ga2de8717e92c5f97ccc6511f6062d6502}{int}} mac\+\_\+size, \+\_\+\+\_\+7\+\_\+ data aad)
\begin{DoxyCompactList}\small\item\em Returns a \mbox{\hyperlink{class_qore_1_1_transform}{Transform}} object for encrypting data using the given \mbox{\hyperlink{group__crypto__transformations}{algorithm}} for use with \mbox{\hyperlink{class_qore_1_1_transform_input_stream}{Transform\+Input\+Stream}} and \mbox{\hyperlink{class_qore_1_1_transform_output_stream}{Transform\+Output\+Stream}}. \end{DoxyCompactList}\item 
\mbox{\hyperlink{group__type__conversion__functions_gaf11c7f5c43ced1e9b95bd2270ee87ed9}{binary}} \mbox{\hyperlink{group__hmac__functions_gaa5fd7a2cd931d0390368d54865602c20}{Qore\+::get\+\_\+random\+\_\+bytes}} (\mbox{\hyperlink{group__type__conversion__functions_ga2de8717e92c5f97ccc6511f6062d6502}{int}} size)
\begin{DoxyCompactList}\small\item\em returns a binary value of random bytes using openssl \end{DoxyCompactList}\item 
\mbox{\hyperlink{group__type__conversion__functions_gaf11c7f5c43ced1e9b95bd2270ee87ed9}{binary}} \mbox{\hyperlink{group__hmac__functions_gaf88021aec5a7048984b0a0e5ce21733d}{Qore\+::hmac}} (\mbox{\hyperlink{group__type__conversion__functions_gacf16b4126b795f4b6933ef3425cadae3}{string}} \mbox{\hyperlink{group__hmac__functions_gaefc09e78e7bccccf7bc3629e4e86c9e2}{digest}}, data data, data key)
\begin{DoxyCompactList}\small\item\em Returns the digest-\/based H\+M\+AC of the supplied arguments as a binary value. \end{DoxyCompactList}\end{DoxyCompactItemize}


\doxysubsection{Detailed Description}
Qore\textquotesingle{}s cryptography support is provided by the Open\+S\+SL library. 

In cryptography, a keyed-\/hash message authentication code (H\+M\+AC) is a specific construction for calculating a message authentication code (M\+AC) involving a cryptographic hash function in combination with a secret cryptographic key. As with any M\+AC, it may be used to simultaneously verify both the data integrity and the authentication of a message. Any cryptographic hash function, such as M\+D5 or S\+H\+A-\/1, may be used in the calculation of an H\+M\+AC; the resulting M\+AC algorithm is termed H\+M\+A\+C-\/\+M\+D5 or H\+M\+A\+C-\/\+S\+H\+A1 accordingly. The cryptographic strength of the H\+M\+AC depends upon the cryptographic strength of the underlying hash function, the size of its hash output, and on the size and quality of the key.

For more info\+: \href{http://en.wikipedia.org/wiki/Hmac}{\texttt{ Wikipedia\textquotesingle{}s Hash-\/based message authentication code article}}.

See also\+:
\begin{DoxyItemize}
\item \mbox{\hyperlink{group__cryptographic__functions}{Cryptographic Functions}}
\item \mbox{\hyperlink{group__digest__functions}{Digest (Hash) Functions}}
\item \mbox{\hyperlink{group__cryptographic__constants}{Cryptographic Contants}} 
\end{DoxyItemize}

\doxysubsection{Function Documentation}
\mbox{\Hypertarget{group__hmac__functions_gad159aa97f0f07e827e74b4b9a12b92ca}\label{group__hmac__functions_gad159aa97f0f07e827e74b4b9a12b92ca}} 
\index{HMAC Functions@{HMAC Functions}!decrypt\_to\_binary@{decrypt\_to\_binary}}
\index{decrypt\_to\_binary@{decrypt\_to\_binary}!HMAC Functions@{HMAC Functions}}
\doxysubsubsection{\texorpdfstring{decrypt\_to\_binary()}{decrypt\_to\_binary()}}
{\footnotesize\ttfamily \mbox{\hyperlink{group__type__conversion__functions_gaf11c7f5c43ced1e9b95bd2270ee87ed9}{binary}} Qore\+::decrypt\+\_\+to\+\_\+binary (\begin{DoxyParamCaption}\item[{\mbox{\hyperlink{group__type__conversion__functions_gacf16b4126b795f4b6933ef3425cadae3}{string}}}]{alg,  }\item[{data}]{data,  }\item[{data}]{key,  }\item[{data}]{iv = {\ttfamily \mbox{\hyperlink{group__cryptographic__constants_ga3e258a2c4d9e99eb43a97e7bf1dbe870}{Qore\+::\+Default\+IV}}},  }\item[{\+\_\+\+\_\+7\+\_\+ data}]{mac,  }\item[{\+\_\+\+\_\+7\+\_\+ data}]{aad }\end{DoxyParamCaption})}



Returns a binary value of decrypted data corresponding to the input arguments inluding the given \mbox{\hyperlink{group__crypto__transformations}{algorithm}}. 

\begin{DoxyParagraph}{Code Flags\+:}
\mbox{\hyperlink{code_flags_RET_VALUE_ONLY}{R\+E\+T\+\_\+\+V\+A\+L\+U\+E\+\_\+\+O\+N\+LY}}
\end{DoxyParagraph}
\begin{DoxyParagraph}{Example\+:}

\begin{DoxyCode}{0}
\DoxyCodeLine{binary bin = \mbox{\hyperlink{group__hmac__functions_gad159aa97f0f07e827e74b4b9a12b92ca}{decrypt\_to\_binary}}(Qore::CRYPTO\_ALG\_BLOWFISH, data, key);}
\end{DoxyCode}

\end{DoxyParagraph}

\begin{DoxyParams}{Parameters}
{\em alg} & the transformation algorithm; see \mbox{\hyperlink{group__crypto__transformations}{Cryptographic Stream Transformations}} for possible values \\
\hline
{\em data} & the data to decrypt \\
\hline
{\em key} & the encryption key \\
\hline
{\em iv} & the initialization vector or cryptographic nonce \\
\hline
{\em mac} & a message authentication code to be used to decrypt the message if required by the cryptographic algorithm, if not required, this argument is ignored \\
\hline
{\em aad} & \href{https://www.cryptopp.com/wiki/ADATA}{\texttt{ Additional Authenticated Data}}; if the cryptographic algorithm does not support A\+AD, then this argument is ignored\\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
a binary value of decrypted data corresponding to the input arguments
\end{DoxyReturn}

\begin{DoxyExceptions}{Exceptions}
{\em D\+E\+C\+R\+Y\+P\+T-\/\+E\+R\+R\+OR} & unknown decryption algorithm; error with the decryption algorithm (ex\+: invalid key)\\
\hline
\end{DoxyExceptions}
\begin{DoxySeeAlso}{See also}

\begin{DoxyItemize}
\item \mbox{\hyperlink{group__hmac__functions_ga94bc9698c368c32987d7207096806df1}{Qore\+::decrypt\+\_\+to\+\_\+string()}}
\item \mbox{\hyperlink{group__hmac__functions_ga7141b56ffa6c5a4f8c9c58f788f33780}{Qore\+::encrypt()}}
\item \mbox{\hyperlink{group__hmac__functions_ga23662a1e7f11f483a6e841da96389197}{Qore\+::get\+\_\+crypto\+\_\+info()}}
\item \mbox{\hyperlink{group__hmac__functions_ga913932d6120f9ea1e3918168fb204976}{Qore\+::get\+\_\+decryptor()}}
\item \mbox{\hyperlink{group__hmac__functions_ga6e67ba0396d70cd012f7c46c7562b81f}{Qore\+::get\+\_\+encryptor()}}
\end{DoxyItemize}
\end{DoxySeeAlso}
\begin{DoxySince}{Since}
Qore 0.\+8.\+13 
\end{DoxySince}
\mbox{\Hypertarget{group__hmac__functions_ga94bc9698c368c32987d7207096806df1}\label{group__hmac__functions_ga94bc9698c368c32987d7207096806df1}} 
\index{HMAC Functions@{HMAC Functions}!decrypt\_to\_string@{decrypt\_to\_string}}
\index{decrypt\_to\_string@{decrypt\_to\_string}!HMAC Functions@{HMAC Functions}}
\doxysubsubsection{\texorpdfstring{decrypt\_to\_string()}{decrypt\_to\_string()}}
{\footnotesize\ttfamily \mbox{\hyperlink{group__type__conversion__functions_gacf16b4126b795f4b6933ef3425cadae3}{string}} Qore\+::decrypt\+\_\+to\+\_\+string (\begin{DoxyParamCaption}\item[{\mbox{\hyperlink{group__type__conversion__functions_gacf16b4126b795f4b6933ef3425cadae3}{string}}}]{alg,  }\item[{data}]{data,  }\item[{data}]{key,  }\item[{data}]{iv = {\ttfamily \mbox{\hyperlink{group__cryptographic__constants_ga3e258a2c4d9e99eb43a97e7bf1dbe870}{Qore\+::\+Default\+IV}}},  }\item[{\+\_\+\+\_\+7\+\_\+ data}]{mac,  }\item[{\+\_\+\+\_\+7\+\_\+ data}]{aad,  }\item[{\+\_\+\+\_\+7\+\_\+ \mbox{\hyperlink{group__type__conversion__functions_gacf16b4126b795f4b6933ef3425cadae3}{string}}}]{encoding }\end{DoxyParamCaption})}



Returns a string of decrypted data corresponding to the input arguments inluding the given \mbox{\hyperlink{group__crypto__transformations}{algorithm}}. 

\begin{DoxyParagraph}{Code Flags\+:}
\mbox{\hyperlink{code_flags_RET_VALUE_ONLY}{R\+E\+T\+\_\+\+V\+A\+L\+U\+E\+\_\+\+O\+N\+LY}}
\end{DoxyParagraph}
\begin{DoxyParagraph}{Example\+:}

\begin{DoxyCode}{0}
\DoxyCodeLine{string str = \mbox{\hyperlink{group__hmac__functions_ga94bc9698c368c32987d7207096806df1}{decrypt\_to\_string}}(Qore::CRYPTO\_ALG\_BLOWFISH, data, key);}
\end{DoxyCode}

\end{DoxyParagraph}

\begin{DoxyParams}{Parameters}
{\em alg} & the transformation algorithm; see \mbox{\hyperlink{group__crypto__transformations}{Cryptographic Stream Transformations}} for possible values \\
\hline
{\em data} & the data to decrypt \\
\hline
{\em key} & the encryption key \\
\hline
{\em iv} & the initialization vector or cryptographic nonce \\
\hline
{\em mac} & a message authentication code to be used to decrypt the message if required by the cryptographic algorithm, if not required, this argument is ignored \\
\hline
{\em aad} & \href{https://www.cryptopp.com/wiki/ADATA}{\texttt{ Additional Authenticated Data}}; if the cryptographic algorithm does not support A\+AD, then this argument is ignored \\
\hline
{\em encoding} & the character encoding tag for the string return value; if not present, the \mbox{\hyperlink{character_encoding_default_encoding}{default character encoding}} is assumed\\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
a string of decrypted data corresponding to the input arguments
\end{DoxyReturn}

\begin{DoxyExceptions}{Exceptions}
{\em D\+E\+C\+R\+Y\+P\+T-\/\+E\+R\+R\+OR} & unknown decryption algorithm; error with the decryption algorithm (ex\+: invalid key)\\
\hline
\end{DoxyExceptions}
\begin{DoxySeeAlso}{See also}

\begin{DoxyItemize}
\item \mbox{\hyperlink{group__hmac__functions_gad159aa97f0f07e827e74b4b9a12b92ca}{Qore\+::decrypt\+\_\+to\+\_\+binary()}}
\item \mbox{\hyperlink{group__hmac__functions_ga7141b56ffa6c5a4f8c9c58f788f33780}{Qore\+::encrypt()}}
\item \mbox{\hyperlink{group__hmac__functions_ga23662a1e7f11f483a6e841da96389197}{Qore\+::get\+\_\+crypto\+\_\+info()}}
\item \mbox{\hyperlink{group__hmac__functions_ga913932d6120f9ea1e3918168fb204976}{Qore\+::get\+\_\+decryptor()}}
\item \mbox{\hyperlink{group__hmac__functions_ga6e67ba0396d70cd012f7c46c7562b81f}{Qore\+::get\+\_\+encryptor()}}
\end{DoxyItemize}
\end{DoxySeeAlso}
\begin{DoxySince}{Since}
Qore 0.\+8.\+13 
\end{DoxySince}
\mbox{\Hypertarget{group__hmac__functions_gaefc09e78e7bccccf7bc3629e4e86c9e2}\label{group__hmac__functions_gaefc09e78e7bccccf7bc3629e4e86c9e2}} 
\index{HMAC Functions@{HMAC Functions}!digest@{digest}}
\index{digest@{digest}!HMAC Functions@{HMAC Functions}}
\doxysubsubsection{\texorpdfstring{digest()}{digest()}}
{\footnotesize\ttfamily \mbox{\hyperlink{group__type__conversion__functions_gaf11c7f5c43ced1e9b95bd2270ee87ed9}{binary}} Qore\+::digest (\begin{DoxyParamCaption}\item[{\mbox{\hyperlink{group__type__conversion__functions_gacf16b4126b795f4b6933ef3425cadae3}{string}}}]{digest,  }\item[{data}]{data }\end{DoxyParamCaption})}



Returns the digest of the supplied arguments as a binary value. 

\begin{DoxyParagraph}{Code Flags\+:}
\mbox{\hyperlink{code_flags_RET_VALUE_ONLY}{R\+E\+T\+\_\+\+V\+A\+L\+U\+E\+\_\+\+O\+N\+LY}}
\end{DoxyParagraph}
\begin{DoxyParagraph}{Example\+:}

\begin{DoxyCode}{0}
\DoxyCodeLine{binary bin = \mbox{\hyperlink{group__hmac__functions_gaefc09e78e7bccccf7bc3629e4e86c9e2}{digest}}(\textcolor{stringliteral}{"md2"}, \textcolor{stringliteral}{"Hello There This is a Test -\/ 1234567890"});}
\DoxyCodeLine{\textcolor{comment}{\# returns <a9046c73e00331af68917d3804f70655>}}
\end{DoxyCode}

\end{DoxyParagraph}

\begin{DoxyParams}{Parameters}
{\em digest} & the digest to use; for supported digests, see \mbox{\hyperlink{group__digest__algorithms_ga08088b7c0d1162c80782a6dbd8fa05a7}{Digest\+Map}} \\
\hline
{\em data} & the data to process and produce a digest for; the trailing null character is not included in the digest when processing string arguments\\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
the binary value of the digest
\end{DoxyReturn}

\begin{DoxyExceptions}{Exceptions}
{\em D\+I\+G\+E\+S\+T-\/\+E\+R\+R\+OR} & unknown digest \\
\hline
{\em D\+I\+G\+E\+S\+T-\/\+C\+A\+L\+C\+U\+L\+A\+T\+I\+O\+N-\/\+E\+R\+R\+OR} & error calculating digest (should not normally happen)\\
\hline
\end{DoxyExceptions}
\begin{DoxySince}{Since}
Qore 0.\+9.\+3 
\end{DoxySince}
\mbox{\Hypertarget{group__hmac__functions_ga3a75abdcf6815bd9c15ae55f5d8f0cc7}\label{group__hmac__functions_ga3a75abdcf6815bd9c15ae55f5d8f0cc7}} 
\index{HMAC Functions@{HMAC Functions}!DSS1\_hmac@{DSS1\_hmac}}
\index{DSS1\_hmac@{DSS1\_hmac}!HMAC Functions@{HMAC Functions}}
\doxysubsubsection{\texorpdfstring{DSS1\_hmac()}{DSS1\_hmac()}}
{\footnotesize\ttfamily \mbox{\hyperlink{group__type__conversion__functions_gacf16b4126b795f4b6933ef3425cadae3}{string}} Qore\+::\+D\+S\+S1\+\_\+hmac (\begin{DoxyParamCaption}\item[{data}]{data,  }\item[{data}]{key }\end{DoxyParamCaption})}



Returns the D\+S\+S1 (S\+H\+A-\/1 and \href{http://en.wikipedia.org/wiki/Digital_Signature_Algorithm}{\texttt{ D\+SA}}) based H\+M\+AC of the supplied argument as a hex string. 


\begin{DoxyParams}{Parameters}
{\em data} & the data to process and produce a digest for; the trailing null character is not included in the digest when processing string arguments \\
\hline
{\em key} & a secret passphrase/key\\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
a hex string of the digest (ex\+: {\ttfamily \char`\"{}37a3cc73159aa129b0eb22bbdf4b9309d389f629\char`\"{}})
\end{DoxyReturn}
\begin{DoxyParagraph}{Example\+:}

\begin{DoxyCode}{0}
\DoxyCodeLine{string str = \mbox{\hyperlink{group__hmac__functions_ga3a75abdcf6815bd9c15ae55f5d8f0cc7}{DSS1\_hmac}}(\textcolor{stringliteral}{"Hello There This is a Test -\/ 1234567890"}, \textcolor{stringliteral}{"a key"});}
\DoxyCodeLine{\textcolor{comment}{\# returns "37a3cc73159aa129b0eb22bbdf4b9309d389f629"}}
\end{DoxyCode}

\end{DoxyParagraph}
\begin{DoxyNote}{Note}
this digest algorithm is considered outdated and is included for backwards-\/compatibility only when Qore is built with an older openssl library
\end{DoxyNote}

\begin{DoxyExceptions}{Exceptions}
{\em D\+S\+S1-\/\+H\+M\+A\+C-\/\+E\+R\+R\+OR} & error calculating digest (should not normally happen)\\
\hline
\end{DoxyExceptions}
\begin{DoxySeeAlso}{See also}
\mbox{\hyperlink{group__hmac__functions_gaf88021aec5a7048984b0a0e5ce21733d}{hmac()}} 
\end{DoxySeeAlso}
\mbox{\Hypertarget{group__hmac__functions_gaca49d7d4e9a7999b7b11ffa734d98cf3}\label{group__hmac__functions_gaca49d7d4e9a7999b7b11ffa734d98cf3}} 
\index{HMAC Functions@{HMAC Functions}!DSS\_hmac@{DSS\_hmac}}
\index{DSS\_hmac@{DSS\_hmac}!HMAC Functions@{HMAC Functions}}
\doxysubsubsection{\texorpdfstring{DSS\_hmac()}{DSS\_hmac()}}
{\footnotesize\ttfamily \mbox{\hyperlink{group__type__conversion__functions_gacf16b4126b795f4b6933ef3425cadae3}{string}} Qore\+::\+D\+S\+S\+\_\+hmac (\begin{DoxyParamCaption}\item[{data}]{data,  }\item[{data}]{key }\end{DoxyParamCaption})}



Returns the D\+SS (S\+H\+A-\/0 and \href{http://en.wikipedia.org/wiki/Digital_Signature_Algorithm}{\texttt{ D\+SA}}) based H\+M\+AC of the supplied argument as a hex string. 


\begin{DoxyParams}{Parameters}
{\em data} & the data to process and produce a digest for; the trailing null character is not included in the digest when processing string arguments \\
\hline
{\em key} & a secret passphrase/key\\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
a hex string of the digest (ex\+: {\ttfamily \char`\"{}37a3cc73159aa129b0eb22bbdf4b9309d389f629\char`\"{}})
\end{DoxyReturn}
\begin{DoxyParagraph}{Example\+:}

\begin{DoxyCode}{0}
\DoxyCodeLine{string str = \mbox{\hyperlink{group__hmac__functions_gaca49d7d4e9a7999b7b11ffa734d98cf3}{DSS\_hmac}}(\textcolor{stringliteral}{"Hello There This is a Test -\/ 1234567890"}, \textcolor{stringliteral}{"a key"});}
\DoxyCodeLine{\textcolor{comment}{\# returns "37a3cc73159aa129b0eb22bbdf4b9309d389f629"}}
\end{DoxyCode}

\end{DoxyParagraph}
\begin{DoxyNote}{Note}
this digest algorithm is considered outdated and is included for backwards-\/compatibility only when Qore is built with an older openssl library
\end{DoxyNote}

\begin{DoxyExceptions}{Exceptions}
{\em D\+S\+S-\/\+H\+M\+A\+C-\/\+E\+R\+R\+OR} & error calculating digest (should not normally happen)\\
\hline
\end{DoxyExceptions}
\begin{DoxySeeAlso}{See also}
\mbox{\hyperlink{group__hmac__functions_gaf88021aec5a7048984b0a0e5ce21733d}{hmac()}} 
\end{DoxySeeAlso}
\mbox{\Hypertarget{group__hmac__functions_ga7141b56ffa6c5a4f8c9c58f788f33780}\label{group__hmac__functions_ga7141b56ffa6c5a4f8c9c58f788f33780}} 
\index{HMAC Functions@{HMAC Functions}!encrypt@{encrypt}}
\index{encrypt@{encrypt}!HMAC Functions@{HMAC Functions}}
\doxysubsubsection{\texorpdfstring{encrypt()}{encrypt()}}
{\footnotesize\ttfamily \mbox{\hyperlink{group__type__conversion__functions_gaf11c7f5c43ced1e9b95bd2270ee87ed9}{binary}} Qore\+::encrypt (\begin{DoxyParamCaption}\item[{\mbox{\hyperlink{group__type__conversion__functions_gacf16b4126b795f4b6933ef3425cadae3}{string}}}]{alg,  }\item[{data}]{data,  }\item[{data}]{key,  }\item[{data}]{iv = {\ttfamily \mbox{\hyperlink{group__cryptographic__constants_ga3e258a2c4d9e99eb43a97e7bf1dbe870}{Qore\+::\+Default\+IV}}},  }\item[{\+\_\+\+\_\+7\+\_\+ reference$<$ \mbox{\hyperlink{group__type__conversion__functions_gaf11c7f5c43ced1e9b95bd2270ee87ed9}{binary}} $>$}]{mac,  }\item[{\+\_\+\+\_\+7\+\_\+ \mbox{\hyperlink{group__type__conversion__functions_ga2de8717e92c5f97ccc6511f6062d6502}{int}}}]{mac\+\_\+size,  }\item[{\+\_\+\+\_\+7\+\_\+ data}]{aad }\end{DoxyParamCaption})}



Returns a binary value of encrypted data corresponding to the input arguments inluding the given \mbox{\hyperlink{group__crypto__transformations}{algorithm}}. 

\begin{DoxyParagraph}{Code Flags\+:}
\mbox{\hyperlink{code_flags_RET_VALUE_ONLY}{R\+E\+T\+\_\+\+V\+A\+L\+U\+E\+\_\+\+O\+N\+LY}}
\end{DoxyParagraph}
\begin{DoxyParagraph}{Example\+:}

\begin{DoxyCode}{0}
\DoxyCodeLine{binary bin = \mbox{\hyperlink{group__hmac__functions_ga7141b56ffa6c5a4f8c9c58f788f33780}{encrypt}}(Qore::CRYPTO\_ALG\_BLOWFISH, data, key);}
\end{DoxyCode}

\end{DoxyParagraph}

\begin{DoxyParams}{Parameters}
{\em alg} & the transformation algorithm; see \mbox{\hyperlink{group__crypto__transformations}{Cryptographic Stream Transformations}} for possible values \\
\hline
{\em data} & the data to encrypt \\
\hline
{\em key} & the encryption key \\
\hline
{\em iv} & the initialization vector or cryptographic nonce \\
\hline
{\em mac} & a reference to a \mbox{\hyperlink{data_type_declarations_binary_type}{binary}} lvalue that will store the \href{https://en.wikipedia.org/wiki/Message_authentication_code}{\texttt{ Message Authentication Code (M\+AC)}} when the transformation is closed, if the algorithm produces one; it is not an error to provide a reference here for cryptographic algorithms that do not generate a M\+AC, however in such cases, nothing will be written to the reference; in case this argument is passed, the {\itshape mac\+\_\+size} argument must also be passed or a {\ttfamily M\+A\+C-\/\+E\+R\+R\+OR} exception will be thrown \\
\hline
{\em mac\+\_\+size} & number of bytes of the M\+AC to return; this value must be non-\/negative and less than 4096 or a {\ttfamily M\+A\+C-\/\+E\+R\+R\+OR} exception will be thrown \\
\hline
{\em aad} & \href{https://www.cryptopp.com/wiki/ADATA}{\texttt{ Additional Authenticated Data}}; if the cryptographic algorithm does not support A\+AD, then this argument is ignored\\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
a binary value of encrypted data corresponding to the input arguments
\end{DoxyReturn}

\begin{DoxyExceptions}{Exceptions}
{\em M\+A\+C-\/\+E\+R\+R\+OR} & this exception is thrown if the {\itshape mac\+\_\+size} argument is passed but no {\itshape mac} argument or vice-\/versa or if the {\itshape mac\+\_\+size} argument is negative or greater than 4096 bytes \\
\hline
{\em E\+N\+C\+R\+Y\+P\+T-\/\+E\+R\+R\+OR} & unknown encryption algorithm; error with the encryption algorithm (ex\+: invalid key size)\\
\hline
\end{DoxyExceptions}
\begin{DoxySeeAlso}{See also}

\begin{DoxyItemize}
\item \mbox{\hyperlink{group__hmac__functions_gad159aa97f0f07e827e74b4b9a12b92ca}{Qore\+::decrypt\+\_\+to\+\_\+binary()}}
\item \mbox{\hyperlink{group__hmac__functions_ga94bc9698c368c32987d7207096806df1}{Qore\+::decrypt\+\_\+to\+\_\+string()}}
\item \mbox{\hyperlink{group__hmac__functions_ga23662a1e7f11f483a6e841da96389197}{Qore\+::get\+\_\+crypto\+\_\+info()}}
\item \mbox{\hyperlink{group__hmac__functions_ga913932d6120f9ea1e3918168fb204976}{Qore\+::get\+\_\+decryptor()}}
\item \mbox{\hyperlink{group__hmac__functions_ga6e67ba0396d70cd012f7c46c7562b81f}{Qore\+::get\+\_\+encryptor()}}
\end{DoxyItemize}
\end{DoxySeeAlso}
\begin{DoxySince}{Since}
Qore 0.\+8.\+13 
\end{DoxySince}
\mbox{\Hypertarget{group__hmac__functions_ga23662a1e7f11f483a6e841da96389197}\label{group__hmac__functions_ga23662a1e7f11f483a6e841da96389197}} 
\index{HMAC Functions@{HMAC Functions}!get\_crypto\_info@{get\_crypto\_info}}
\index{get\_crypto\_info@{get\_crypto\_info}!HMAC Functions@{HMAC Functions}}
\doxysubsubsection{\texorpdfstring{get\_crypto\_info()}{get\_crypto\_info()}}
{\footnotesize\ttfamily \mbox{\hyperlink{group__type__conversion__functions_ga0231dbb472dd230310af7c7c34f56e92}{hash}} Qore\+::get\+\_\+crypto\+\_\+info (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption})}



Returns a hash of information about each cryptographic algorithmn supported by the current build of Qore. 

\begin{DoxyParagraph}{Code Flags\+:}
\mbox{\hyperlink{code_flags_CONSTANT}{C\+O\+N\+S\+T\+A\+NT}}
\end{DoxyParagraph}
\begin{DoxyParagraph}{Example\+:}

\begin{DoxyCode}{0}
\DoxyCodeLine{hash h = \mbox{\hyperlink{group__hmac__functions_ga23662a1e7f11f483a6e841da96389197}{get\_crypto\_info}}();}
\end{DoxyCode}

\end{DoxyParagraph}
\begin{DoxyReturn}{Returns}
a hash of information about each cryptographic algorithmn supported by the current build of Qore; keys are algorithm names, values are hashes with the following keys\+:
\begin{DoxyItemize}
\item {\ttfamily key\+\_\+len\+:} the minimum required length of the cryptographic key; if 0 it means that the cipher takes a variable key length
\item {\ttfamily iv\+\_\+len\+:} the minimum required lengh of the initialization vector or nonce; if 0 it means that the initialization vector can be of any length (note that initialization vector or nonce is always optional); -\/1 means that the algorithm does not support (ignores) initialization vectors
\item {\ttfamily type\+:} either {\ttfamily \char`\"{}\+G\+C\+M\char`\"{}} for \href{https://en.wikipedia.org/wiki/Galois/Counter_Mode}{\texttt{ Galois Counter Mode}} (meaning that the cipher accepts A\+AD and produces / requires a \href{https://en.wikipedia.org/wiki/Message_authentication_code}{\texttt{ Message Authentication Code (M\+AC)}} for encryption / decryption, respectively) or {\ttfamily \char`\"{}\+C\+B\+C\char`\"{}} for \href{http://en.wikipedia.org/wiki/Cipher_block_chaining\#Cipher-block_chaining_.28CBC.29}{\texttt{ Cipher Block Chaining}} (meaning that the cipher does not support A\+AD or a M\+AC)
\end{DoxyItemize}
\end{DoxyReturn}
\begin{DoxySeeAlso}{See also}

\begin{DoxyItemize}
\item \mbox{\hyperlink{group__hmac__functions_gad159aa97f0f07e827e74b4b9a12b92ca}{Qore\+::decrypt\+\_\+to\+\_\+binary()}}
\item \mbox{\hyperlink{group__hmac__functions_ga94bc9698c368c32987d7207096806df1}{Qore\+::decrypt\+\_\+to\+\_\+string()}}
\item \mbox{\hyperlink{group__hmac__functions_ga7141b56ffa6c5a4f8c9c58f788f33780}{Qore\+::encrypt()}}
\item \mbox{\hyperlink{group__hmac__functions_ga913932d6120f9ea1e3918168fb204976}{Qore\+::get\+\_\+decryptor()}}
\item \mbox{\hyperlink{group__hmac__functions_ga6e67ba0396d70cd012f7c46c7562b81f}{Qore\+::get\+\_\+encryptor()}}
\end{DoxyItemize}
\end{DoxySeeAlso}
\begin{DoxySince}{Since}
Qore 0.\+8.\+13 
\end{DoxySince}
\mbox{\Hypertarget{group__hmac__functions_ga913932d6120f9ea1e3918168fb204976}\label{group__hmac__functions_ga913932d6120f9ea1e3918168fb204976}} 
\index{HMAC Functions@{HMAC Functions}!get\_decryptor@{get\_decryptor}}
\index{get\_decryptor@{get\_decryptor}!HMAC Functions@{HMAC Functions}}
\doxysubsubsection{\texorpdfstring{get\_decryptor()}{get\_decryptor()}}
{\footnotesize\ttfamily \mbox{\hyperlink{class_qore_1_1_transform}{Transform}} Qore\+::get\+\_\+decryptor (\begin{DoxyParamCaption}\item[{\mbox{\hyperlink{group__type__conversion__functions_gacf16b4126b795f4b6933ef3425cadae3}{string}}}]{alg,  }\item[{data}]{key,  }\item[{data}]{iv = {\ttfamily \mbox{\hyperlink{group__cryptographic__constants_ga3e258a2c4d9e99eb43a97e7bf1dbe870}{Qore\+::\+Default\+IV}}},  }\item[{\+\_\+\+\_\+7\+\_\+ data}]{mac,  }\item[{\+\_\+\+\_\+7\+\_\+ data}]{aad }\end{DoxyParamCaption})}



Returns a \mbox{\hyperlink{class_qore_1_1_transform}{Transform}} object for decrypting data using the given \mbox{\hyperlink{group__crypto__transformations}{algorithm}} for use with \mbox{\hyperlink{class_qore_1_1_transform_input_stream}{Transform\+Input\+Stream}} and \mbox{\hyperlink{class_qore_1_1_transform_output_stream}{Transform\+Output\+Stream}}. 

\begin{DoxyParagraph}{Code Flags\+:}
\mbox{\hyperlink{code_flags_RET_VALUE_ONLY}{R\+E\+T\+\_\+\+V\+A\+L\+U\+E\+\_\+\+O\+N\+LY}}
\end{DoxyParagraph}
\begin{DoxyParagraph}{Example\+:}

\begin{DoxyCode}{0}
\DoxyCodeLine{Qore::FileOutputStream of(\textcolor{stringliteral}{"my-\/file.txt.enc"});}
\DoxyCodeLine{Qore::TransformOutputStream ts(of, \mbox{\hyperlink{group__hmac__functions_ga913932d6120f9ea1e3918168fb204976}{get\_decryptor}}(Qore::CRYPTO\_ALG\_BLOWFISH, key));}
\end{DoxyCode}

\end{DoxyParagraph}

\begin{DoxyParams}{Parameters}
{\em alg} & the transformation algorithm; see \mbox{\hyperlink{group__crypto__transformations}{Cryptographic Stream Transformations}} for possible values \\
\hline
{\em key} & the encryption key \\
\hline
{\em iv} & the initialization vector \\
\hline
{\em mac} & a message authentication code to be used to decrypt the message if required by the cryptographic algorithm, if not required, this argument is ignored \\
\hline
{\em aad} & \href{https://www.cryptopp.com/wiki/ADATA}{\texttt{ Additional Authenticated Data}}; if the cryptographic algorithm does not support A\+AD, then this argument is ignored\\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
a \mbox{\hyperlink{class_qore_1_1_transform}{Transform}} object for decrypting data using the given \mbox{\hyperlink{group__crypto__transformations}{algorithm}} for use with \mbox{\hyperlink{class_qore_1_1_transform_input_stream}{Transform\+Input\+Stream}} and \mbox{\hyperlink{class_qore_1_1_transform_output_stream}{Transform\+Output\+Stream}}
\end{DoxyReturn}

\begin{DoxyExceptions}{Exceptions}
{\em D\+E\+C\+R\+Y\+P\+T-\/\+E\+R\+R\+OR} & unknown encryption algorithm; error decrypting the data\\
\hline
\end{DoxyExceptions}
\begin{DoxySeeAlso}{See also}

\begin{DoxyItemize}
\item \mbox{\hyperlink{group__hmac__functions_gad159aa97f0f07e827e74b4b9a12b92ca}{Qore\+::decrypt\+\_\+to\+\_\+binary()}}
\item \mbox{\hyperlink{group__hmac__functions_ga94bc9698c368c32987d7207096806df1}{Qore\+::decrypt\+\_\+to\+\_\+string()}}
\item \mbox{\hyperlink{group__hmac__functions_ga7141b56ffa6c5a4f8c9c58f788f33780}{Qore\+::encrypt()}}
\item \mbox{\hyperlink{group__hmac__functions_ga23662a1e7f11f483a6e841da96389197}{Qore\+::get\+\_\+crypto\+\_\+info()}}
\item \mbox{\hyperlink{group__hmac__functions_ga6e67ba0396d70cd012f7c46c7562b81f}{Qore\+::get\+\_\+encryptor()}}
\end{DoxyItemize}
\end{DoxySeeAlso}
\begin{DoxySince}{Since}
Qore 0.\+8.\+13 
\end{DoxySince}
\mbox{\Hypertarget{group__hmac__functions_ga227c4f084f2cffee4c466989d68a1fe3}\label{group__hmac__functions_ga227c4f084f2cffee4c466989d68a1fe3}} 
\index{HMAC Functions@{HMAC Functions}!get\_digests@{get\_digests}}
\index{get\_digests@{get\_digests}!HMAC Functions@{HMAC Functions}}
\doxysubsubsection{\texorpdfstring{get\_digests()}{get\_digests()}}
{\footnotesize\ttfamily \mbox{\hyperlink{group__type__conversion__functions_ga4b52a1cbee7a3aed46c32cb0a938629c}{list}}$<$\mbox{\hyperlink{group__type__conversion__functions_gacf16b4126b795f4b6933ef3425cadae3}{string}}$>$ Qore\+::get\+\_\+digests (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption})}



Returns a list of supported digest algorithms for \mbox{\hyperlink{group__hmac__functions_gaf88021aec5a7048984b0a0e5ce21733d}{hmac()}} 

\begin{DoxyParagraph}{Code Flags\+:}
\mbox{\hyperlink{code_flags_CONSTANT}{C\+O\+N\+S\+T\+A\+NT}}
\end{DoxyParagraph}
\begin{DoxyParagraph}{Example\+:}

\begin{DoxyCode}{0}
\DoxyCodeLine{\textcolor{comment}{\# make a map of supported digests}}
\DoxyCodeLine{hash<string, bool> digest\_map = map \{\$1: \textcolor{keyword}{True}\}, \mbox{\hyperlink{group__hmac__functions_ga227c4f084f2cffee4c466989d68a1fe3}{get\_digests}}();}
\end{DoxyCode}

\end{DoxyParagraph}
\begin{DoxyReturn}{Returns}
a list of supported digest algorithms for \mbox{\hyperlink{group__hmac__functions_gaf88021aec5a7048984b0a0e5ce21733d}{hmac()}}
\end{DoxyReturn}
\begin{DoxySeeAlso}{See also}
\mbox{\hyperlink{group__hmac__functions_gaf88021aec5a7048984b0a0e5ce21733d}{hmac()}}
\end{DoxySeeAlso}
\begin{DoxySince}{Since}
Qore 0.\+9.\+3 
\end{DoxySince}
\mbox{\Hypertarget{group__hmac__functions_ga6e67ba0396d70cd012f7c46c7562b81f}\label{group__hmac__functions_ga6e67ba0396d70cd012f7c46c7562b81f}} 
\index{HMAC Functions@{HMAC Functions}!get\_encryptor@{get\_encryptor}}
\index{get\_encryptor@{get\_encryptor}!HMAC Functions@{HMAC Functions}}
\doxysubsubsection{\texorpdfstring{get\_encryptor()}{get\_encryptor()}}
{\footnotesize\ttfamily \mbox{\hyperlink{class_qore_1_1_transform}{Transform}} Qore\+::get\+\_\+encryptor (\begin{DoxyParamCaption}\item[{\mbox{\hyperlink{group__type__conversion__functions_gacf16b4126b795f4b6933ef3425cadae3}{string}}}]{alg,  }\item[{data}]{key,  }\item[{data}]{iv = {\ttfamily \mbox{\hyperlink{group__cryptographic__constants_ga3e258a2c4d9e99eb43a97e7bf1dbe870}{Qore\+::\+Default\+IV}}},  }\item[{\+\_\+\+\_\+7\+\_\+ reference$<$ \mbox{\hyperlink{group__type__conversion__functions_gaf11c7f5c43ced1e9b95bd2270ee87ed9}{binary}} $>$}]{mac,  }\item[{\+\_\+\+\_\+7\+\_\+ \mbox{\hyperlink{group__type__conversion__functions_ga2de8717e92c5f97ccc6511f6062d6502}{int}}}]{mac\+\_\+size,  }\item[{\+\_\+\+\_\+7\+\_\+ data}]{aad }\end{DoxyParamCaption})}



Returns a \mbox{\hyperlink{class_qore_1_1_transform}{Transform}} object for encrypting data using the given \mbox{\hyperlink{group__crypto__transformations}{algorithm}} for use with \mbox{\hyperlink{class_qore_1_1_transform_input_stream}{Transform\+Input\+Stream}} and \mbox{\hyperlink{class_qore_1_1_transform_output_stream}{Transform\+Output\+Stream}}. 

\begin{DoxyParagraph}{Code Flags\+:}
\mbox{\hyperlink{code_flags_RET_VALUE_ONLY}{R\+E\+T\+\_\+\+V\+A\+L\+U\+E\+\_\+\+O\+N\+LY}}
\end{DoxyParagraph}
\begin{DoxyParagraph}{Example\+:}

\begin{DoxyCode}{0}
\DoxyCodeLine{Qore::FileOutputStream of(\textcolor{stringliteral}{"my-\/file.txt.enc"});}
\DoxyCodeLine{Qore::TransformOutputStream ts(of, \mbox{\hyperlink{group__hmac__functions_ga6e67ba0396d70cd012f7c46c7562b81f}{get\_encryptor}}(Qore::CRYPTO\_ALG\_BLOWFISH, key));}
\end{DoxyCode}

\end{DoxyParagraph}

\begin{DoxyParams}{Parameters}
{\em alg} & the transformation algorithm; see \mbox{\hyperlink{group__crypto__transformations}{Cryptographic Stream Transformations}} for possible values \\
\hline
{\em key} & the encryption key \\
\hline
{\em iv} & the initialization vector \\
\hline
{\em mac} & a reference to a \mbox{\hyperlink{data_type_declarations_binary_type}{binary}} lvalue that will store the \href{https://en.wikipedia.org/wiki/Message_authentication_code}{\texttt{ Message Authentication Code (M\+AC)}} when the transformation is closed, if the algorithm produces one; it is not an error to provide a reference here for cryptographic algorithms that do not generate a M\+AC, however in such cases, nothing will be written to the reference; in case this argument is passed, the {\itshape mac\+\_\+size} argument must also be passed or a {\ttfamily M\+A\+C-\/\+E\+R\+R\+OR} exception will be thrown \\
\hline
{\em mac\+\_\+size} & number of bytes of the M\+AC to return; this value must be non-\/negative and less than 4096 or a {\ttfamily M\+A\+C-\/\+E\+R\+R\+OR} exception will be thrown \\
\hline
{\em aad} & \href{https://www.cryptopp.com/wiki/ADATA}{\texttt{ Additional Authenticated Data}}; if the cryptographic algorithm does not support A\+AD, then this argument is ignored\\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
a \mbox{\hyperlink{class_qore_1_1_transform}{Transform}} object for encrypting data using the given \mbox{\hyperlink{group__crypto__transformations}{algorithm}} for use with \mbox{\hyperlink{class_qore_1_1_transform_input_stream}{Transform\+Input\+Stream}} and \mbox{\hyperlink{class_qore_1_1_transform_output_stream}{Transform\+Output\+Stream}}
\end{DoxyReturn}

\begin{DoxyExceptions}{Exceptions}
{\em M\+A\+C-\/\+E\+R\+R\+OR} & this exception is thrown if the {\itshape mac\+\_\+size} argument is passed but no {\itshape mac} argument or vice-\/versa or if the {\itshape mac\+\_\+size} argument is negative or greater than 4096 bytes \\
\hline
{\em E\+N\+C\+R\+Y\+P\+T-\/\+E\+R\+R\+OR} & unknown encryption algorithm; error with the encryption algorithm (ex\+: invalid key size)\\
\hline
\end{DoxyExceptions}
\begin{DoxySeeAlso}{See also}

\begin{DoxyItemize}
\item \mbox{\hyperlink{group__hmac__functions_gad159aa97f0f07e827e74b4b9a12b92ca}{Qore\+::decrypt\+\_\+to\+\_\+binary()}}
\item \mbox{\hyperlink{group__hmac__functions_ga94bc9698c368c32987d7207096806df1}{Qore\+::decrypt\+\_\+to\+\_\+string()}}
\item \mbox{\hyperlink{group__hmac__functions_ga7141b56ffa6c5a4f8c9c58f788f33780}{Qore\+::encrypt()}}
\item \mbox{\hyperlink{group__hmac__functions_ga23662a1e7f11f483a6e841da96389197}{Qore\+::get\+\_\+crypto\+\_\+info()}}
\item \mbox{\hyperlink{group__hmac__functions_ga913932d6120f9ea1e3918168fb204976}{Qore\+::get\+\_\+decryptor()}}
\end{DoxyItemize}
\end{DoxySeeAlso}
\begin{DoxySince}{Since}
Qore 0.\+8.\+13 
\end{DoxySince}
\mbox{\Hypertarget{group__hmac__functions_gaa5fd7a2cd931d0390368d54865602c20}\label{group__hmac__functions_gaa5fd7a2cd931d0390368d54865602c20}} 
\index{HMAC Functions@{HMAC Functions}!get\_random\_bytes@{get\_random\_bytes}}
\index{get\_random\_bytes@{get\_random\_bytes}!HMAC Functions@{HMAC Functions}}
\doxysubsubsection{\texorpdfstring{get\_random\_bytes()}{get\_random\_bytes()}}
{\footnotesize\ttfamily \mbox{\hyperlink{group__type__conversion__functions_gaf11c7f5c43ced1e9b95bd2270ee87ed9}{binary}} Qore\+::get\+\_\+random\+\_\+bytes (\begin{DoxyParamCaption}\item[{\mbox{\hyperlink{group__type__conversion__functions_ga2de8717e92c5f97ccc6511f6062d6502}{int}}}]{size }\end{DoxyParamCaption})}



returns a binary value of random bytes using openssl 

\begin{DoxyParagraph}{Code Flags\+:}
\mbox{\hyperlink{code_flags_RET_VALUE_ONLY}{R\+E\+T\+\_\+\+V\+A\+L\+U\+E\+\_\+\+O\+N\+LY}}
\end{DoxyParagraph}
\begin{DoxyParagraph}{Example\+:}

\begin{DoxyCode}{0}
\DoxyCodeLine{\textcolor{comment}{\# return 16 bytes of random data}}
\DoxyCodeLine{binary b = \mbox{\hyperlink{group__hmac__functions_gaa5fd7a2cd931d0390368d54865602c20}{get\_random\_bytes}}(16);}
\end{DoxyCode}

\end{DoxyParagraph}

\begin{DoxyParams}{Parameters}
{\em size} & the number of bytes in the output; if this value is not positive, an empty binary value is returned\\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
a binary value of random bytes using openssl
\end{DoxyReturn}

\begin{DoxyExceptions}{Exceptions}
{\em G\+E\+T-\/\+R\+A\+N\+D\+O\+M-\/\+B\+Y\+T\+E\+S-\/\+E\+R\+R\+OR} & thrown if there is an error generating or acquiring random data (ex\+: not enough entropy; random function not supported by the current random method)\\
\hline
\end{DoxyExceptions}
\begin{DoxySince}{Since}
Qore 0.\+8.\+13 
\end{DoxySince}
\mbox{\Hypertarget{group__hmac__functions_gaf88021aec5a7048984b0a0e5ce21733d}\label{group__hmac__functions_gaf88021aec5a7048984b0a0e5ce21733d}} 
\index{HMAC Functions@{HMAC Functions}!hmac@{hmac}}
\index{hmac@{hmac}!HMAC Functions@{HMAC Functions}}
\doxysubsubsection{\texorpdfstring{hmac()}{hmac()}}
{\footnotesize\ttfamily \mbox{\hyperlink{group__type__conversion__functions_gaf11c7f5c43ced1e9b95bd2270ee87ed9}{binary}} Qore\+::hmac (\begin{DoxyParamCaption}\item[{\mbox{\hyperlink{group__type__conversion__functions_gacf16b4126b795f4b6933ef3425cadae3}{string}}}]{digest,  }\item[{data}]{data,  }\item[{data}]{key }\end{DoxyParamCaption})}



Returns the digest-\/based H\+M\+AC of the supplied arguments as a binary value. 

\begin{DoxyParagraph}{Code Flags\+:}
\mbox{\hyperlink{code_flags_RET_VALUE_ONLY}{R\+E\+T\+\_\+\+V\+A\+L\+U\+E\+\_\+\+O\+N\+LY}}
\end{DoxyParagraph}
\begin{DoxyParagraph}{Example\+:}

\begin{DoxyCode}{0}
\DoxyCodeLine{binary bin = \mbox{\hyperlink{group__hmac__functions_gaf88021aec5a7048984b0a0e5ce21733d}{hmac}}(\textcolor{stringliteral}{"ripemd160"}, \textcolor{stringliteral}{"Hello There This is a Test -\/ 1234567890"}, \textcolor{stringliteral}{"a key"});}
\DoxyCodeLine{\textcolor{comment}{\# returns <4bca70bca1601aba57624eeb2606535cb12f2079>}}
\end{DoxyCode}

\end{DoxyParagraph}

\begin{DoxyParams}{Parameters}
{\em digest} & the digest to use; for supported digests, see \mbox{\hyperlink{group__digest__algorithms_ga08088b7c0d1162c80782a6dbd8fa05a7}{Digest\+Map}} \\
\hline
{\em data} & the data to process and produce a digest for; the trailing null character is not included in the digest when processing string arguments \\
\hline
{\em key} & a secret passphrase/key\\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
the binary value of the H\+M\+AC
\end{DoxyReturn}

\begin{DoxyExceptions}{Exceptions}
{\em D\+I\+G\+E\+S\+T-\/\+E\+R\+R\+OR} & unknown digest \\
\hline
{\em H\+M\+A\+C-\/\+C\+A\+L\+C\+U\+L\+A\+T\+I\+O\+N-\/\+E\+R\+R\+OR} & error calculating digest (should not normally happen)\\
\hline
\end{DoxyExceptions}
\begin{DoxySeeAlso}{See also}
\mbox{\hyperlink{group__digest__algorithms_ga08088b7c0d1162c80782a6dbd8fa05a7}{Digest\+Map}}
\end{DoxySeeAlso}
\begin{DoxySince}{Since}
Qore 0.\+9.\+3 
\end{DoxySince}
\mbox{\Hypertarget{group__hmac__functions_gaeebc2ad2c2cf99a33e42c98344fceb49}\label{group__hmac__functions_gaeebc2ad2c2cf99a33e42c98344fceb49}} 
\index{HMAC Functions@{HMAC Functions}!MD2\_hmac@{MD2\_hmac}}
\index{MD2\_hmac@{MD2\_hmac}!HMAC Functions@{HMAC Functions}}
\doxysubsubsection{\texorpdfstring{MD2\_hmac()}{MD2\_hmac()}}
{\footnotesize\ttfamily \mbox{\hyperlink{group__type__conversion__functions_gacf16b4126b795f4b6933ef3425cadae3}{string}} Qore\+::\+M\+D2\+\_\+hmac (\begin{DoxyParamCaption}\item[{data}]{data,  }\item[{data}]{key }\end{DoxyParamCaption})}



Returns the \href{http://en.wikipedia.org/wiki/MD2_(cryptography)}{\texttt{ M\+D2}} based H\+M\+AC of the supplied argument as a hex string. 

\begin{DoxyParagraph}{Platform Availability\+:}
\mbox{\hyperlink{group__option__constants_ga2e1b34b0ee0e76d35143adeaac8211ba}{Qore\+::\+Option\+::\+H\+A\+V\+E\+\_\+\+M\+D2}}
\end{DoxyParagraph}

\begin{DoxyParams}{Parameters}
{\em data} & the data to process and produce a digest for; the trailing null character is not included in the digest when processing string arguments \\
\hline
{\em key} & a secret passphrase/key\\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
a hex string of the digest (ex\+: {\ttfamily \char`\"{}27f5f17500b408e97643403ea8ef1413\char`\"{}})
\end{DoxyReturn}
\begin{DoxyParagraph}{Example\+:}

\begin{DoxyCode}{0}
\DoxyCodeLine{string str = \mbox{\hyperlink{group__hmac__functions_gaeebc2ad2c2cf99a33e42c98344fceb49}{MD2\_hmac}}(\textcolor{stringliteral}{"Hello There This is a Test -\/ 1234567890"}, \textcolor{stringliteral}{"a key"});}
\DoxyCodeLine{\textcolor{comment}{\# returns "27f5f17500b408e97643403ea8ef1413"}}
\end{DoxyCode}

\end{DoxyParagraph}

\begin{DoxyExceptions}{Exceptions}
{\em M\+D2-\/\+H\+M\+A\+C-\/\+E\+R\+R\+OR} & error calculating digest (should not normally happen)\\
\hline
\end{DoxyExceptions}
\begin{DoxySeeAlso}{See also}

\begin{DoxyItemize}
\item \mbox{\hyperlink{group__hmac__functions_gaf88021aec5a7048984b0a0e5ce21733d}{hmac()}}
\item \mbox{\hyperlink{group__digest__functions_ga92b9dd3feb62a72720cfad39f79dd3e7}{M\+D2\+\_\+bin()}} 
\end{DoxyItemize}
\end{DoxySeeAlso}
\mbox{\Hypertarget{group__hmac__functions_gaa1f5781d25e14ad544f76db36111e1f3}\label{group__hmac__functions_gaa1f5781d25e14ad544f76db36111e1f3}} 
\index{HMAC Functions@{HMAC Functions}!MD4\_hmac@{MD4\_hmac}}
\index{MD4\_hmac@{MD4\_hmac}!HMAC Functions@{HMAC Functions}}
\doxysubsubsection{\texorpdfstring{MD4\_hmac()}{MD4\_hmac()}}
{\footnotesize\ttfamily \mbox{\hyperlink{group__type__conversion__functions_gacf16b4126b795f4b6933ef3425cadae3}{string}} Qore\+::\+M\+D4\+\_\+hmac (\begin{DoxyParamCaption}\item[{data}]{data,  }\item[{data}]{key }\end{DoxyParamCaption})}



Returns the \href{http://en.wikipedia.org/wiki/MD4}{\texttt{ M\+D4}} based H\+M\+AC of the supplied argument as a hex string. 


\begin{DoxyParams}{Parameters}
{\em data} & the data to process and produce a digest for; the trailing null character is not included in the digest when processing string arguments \\
\hline
{\em key} & a secret passphrase/key\\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
a hex string of the digest (ex\+: {\ttfamily \char`\"{}053d084f321a3886e60166ebd9609ce1\char`\"{}})
\end{DoxyReturn}
\begin{DoxyParagraph}{Example\+:}

\begin{DoxyCode}{0}
\DoxyCodeLine{string str = \mbox{\hyperlink{group__hmac__functions_gaa1f5781d25e14ad544f76db36111e1f3}{MD4\_hmac}}(\textcolor{stringliteral}{"Hello There This is a Test -\/ 1234567890"}, \textcolor{stringliteral}{"a key"});}
\DoxyCodeLine{\textcolor{comment}{\# returns "053d084f321a3886e60166ebd9609ce1"}}
\end{DoxyCode}

\end{DoxyParagraph}

\begin{DoxyExceptions}{Exceptions}
{\em M\+D4-\/\+H\+M\+A\+C-\/\+E\+R\+R\+OR} & error calculating digest (should not normally happen)\\
\hline
\end{DoxyExceptions}
\begin{DoxySeeAlso}{See also}
\mbox{\hyperlink{group__hmac__functions_gaf88021aec5a7048984b0a0e5ce21733d}{hmac()}} 
\end{DoxySeeAlso}
\mbox{\Hypertarget{group__hmac__functions_gac4dc67bcb217ae04c43a9df9d14d0a85}\label{group__hmac__functions_gac4dc67bcb217ae04c43a9df9d14d0a85}} 
\index{HMAC Functions@{HMAC Functions}!MD5\_hmac@{MD5\_hmac}}
\index{MD5\_hmac@{MD5\_hmac}!HMAC Functions@{HMAC Functions}}
\doxysubsubsection{\texorpdfstring{MD5\_hmac()}{MD5\_hmac()}}
{\footnotesize\ttfamily \mbox{\hyperlink{group__type__conversion__functions_gacf16b4126b795f4b6933ef3425cadae3}{string}} Qore\+::\+M\+D5\+\_\+hmac (\begin{DoxyParamCaption}\item[{data}]{data,  }\item[{data}]{key }\end{DoxyParamCaption})}



Returns the \href{http://en.wikipedia.org/wiki/MD5}{\texttt{ M\+D5}} based H\+M\+AC of the supplied argument as a hex string. 


\begin{DoxyParams}{Parameters}
{\em data} & the data to process and produce a digest for; the trailing null character is not included in the digest when processing string arguments \\
\hline
{\em key} & a secret passphrase/key\\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
a hex string of the digest (ex\+: {\ttfamily \char`\"{}87505c6164aaf6ca6315233902a01ef4\char`\"{}})
\end{DoxyReturn}
\begin{DoxyParagraph}{Example\+:}

\begin{DoxyCode}{0}
\DoxyCodeLine{string str = \mbox{\hyperlink{group__hmac__functions_gac4dc67bcb217ae04c43a9df9d14d0a85}{MD5\_hmac}}(\textcolor{stringliteral}{"Hello There This is a Test -\/ 1234567890"}, \textcolor{stringliteral}{"a key"});}
\DoxyCodeLine{\textcolor{comment}{\# returns "87505c6164aaf6ca6315233902a01ef4"}}
\end{DoxyCode}

\end{DoxyParagraph}
\begin{DoxyNote}{Note}
the M\+D5 algorithm is not collision-\/resistant; it\textquotesingle{}s recommended to use another hash algorithm (like S\+H\+A-\/256) if cryptographic security is important
\end{DoxyNote}

\begin{DoxyExceptions}{Exceptions}
{\em M\+D5-\/\+H\+M\+A\+C-\/\+E\+R\+R\+OR} & error calculating digest (should not normally happen)\\
\hline
\end{DoxyExceptions}
\begin{DoxySeeAlso}{See also}
\mbox{\hyperlink{group__hmac__functions_gaf88021aec5a7048984b0a0e5ce21733d}{hmac()}} 
\end{DoxySeeAlso}
\mbox{\Hypertarget{group__hmac__functions_ga2839943cdcce18a3e5ef63ac5c728eb2}\label{group__hmac__functions_ga2839943cdcce18a3e5ef63ac5c728eb2}} 
\index{HMAC Functions@{HMAC Functions}!MDC2\_hmac@{MDC2\_hmac}}
\index{MDC2\_hmac@{MDC2\_hmac}!HMAC Functions@{HMAC Functions}}
\doxysubsubsection{\texorpdfstring{MDC2\_hmac()}{MDC2\_hmac()}}
{\footnotesize\ttfamily \mbox{\hyperlink{group__type__conversion__functions_gacf16b4126b795f4b6933ef3425cadae3}{string}} Qore\+::\+M\+D\+C2\+\_\+hmac (\begin{DoxyParamCaption}\item[{data}]{data,  }\item[{data}]{key }\end{DoxyParamCaption})}



Returns the \href{http://en.wikipedia.org/wiki/MDC2}{\texttt{ M\+D\+C2}} based H\+M\+AC of the supplied argument as a hex string. 


\begin{DoxyParams}{Parameters}
{\em data} & the data to process and produce a digest for; the trailing null character is not included in the digest when processing string arguments \\
\hline
{\em key} & a secret passphrase/key\\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
a hex string of the digest (ex\+: {\ttfamily \char`\"{}e0ef6a6803e58807c5db395e180a999c\char`\"{}})
\end{DoxyReturn}
\begin{DoxyParagraph}{Example\+:}

\begin{DoxyCode}{0}
\DoxyCodeLine{string str = \mbox{\hyperlink{group__hmac__functions_ga2839943cdcce18a3e5ef63ac5c728eb2}{MDC2\_hmac}}(\textcolor{stringliteral}{"Hello There This is a Test -\/ 1234567890"}, \textcolor{stringliteral}{"a key"});}
\DoxyCodeLine{\textcolor{comment}{\# returns "e0ef6a6803e58807c5db395e180a999c"}}
\end{DoxyCode}

\end{DoxyParagraph}

\begin{DoxyExceptions}{Exceptions}
{\em M\+D\+C2-\/\+H\+M\+A\+C-\/\+E\+R\+R\+OR} & error calculating digest (should not normally happen)\\
\hline
\end{DoxyExceptions}
\begin{DoxySeeAlso}{See also}
\mbox{\hyperlink{group__hmac__functions_gaf88021aec5a7048984b0a0e5ce21733d}{hmac()}} 
\end{DoxySeeAlso}
\mbox{\Hypertarget{group__hmac__functions_gadecee6c469e1b4dade49924bd68c7ae4}\label{group__hmac__functions_gadecee6c469e1b4dade49924bd68c7ae4}} 
\index{HMAC Functions@{HMAC Functions}!RIPEMD160\_hmac@{RIPEMD160\_hmac}}
\index{RIPEMD160\_hmac@{RIPEMD160\_hmac}!HMAC Functions@{HMAC Functions}}
\doxysubsubsection{\texorpdfstring{RIPEMD160\_hmac()}{RIPEMD160\_hmac()}}
{\footnotesize\ttfamily \mbox{\hyperlink{group__type__conversion__functions_gacf16b4126b795f4b6933ef3425cadae3}{string}} Qore\+::\+R\+I\+P\+E\+M\+D160\+\_\+hmac (\begin{DoxyParamCaption}\item[{data}]{data,  }\item[{data}]{key }\end{DoxyParamCaption})}



Returns the \href{http://en.wikipedia.org/wiki/RIPEMD}{\texttt{ R\+I\+P\+E\+MD}} based H\+M\+AC of the supplied argument as a hex string. 


\begin{DoxyParams}{Parameters}
{\em data} & the data to process and produce a digest for; the trailing null character is not included in the digest when processing string arguments \\
\hline
{\em key} & a secret passphrase/key\\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
a hex string of the digest (ex\+: {\ttfamily \char`\"{}4bca70bca1601aba57624eeb2606535cb12f2079\char`\"{}})
\end{DoxyReturn}
\begin{DoxyParagraph}{Example\+:}

\begin{DoxyCode}{0}
\DoxyCodeLine{string str = \mbox{\hyperlink{group__hmac__functions_gadecee6c469e1b4dade49924bd68c7ae4}{RIPEMD160\_hmac}}(\textcolor{stringliteral}{"Hello There This is a Test -\/ 1234567890"}, \textcolor{stringliteral}{"a key"});}
\DoxyCodeLine{\textcolor{comment}{\# returns "4bca70bca1601aba57624eeb2606535cb12f2079"}}
\end{DoxyCode}

\end{DoxyParagraph}

\begin{DoxyExceptions}{Exceptions}
{\em R\+I\+P\+E\+M\+D160-\/\+H\+M\+A\+C-\/\+E\+R\+R\+OR} & error calculating digest (should not normally happen)\\
\hline
\end{DoxyExceptions}
\begin{DoxySeeAlso}{See also}
\mbox{\hyperlink{group__hmac__functions_gaf88021aec5a7048984b0a0e5ce21733d}{hmac()}} 
\end{DoxySeeAlso}
\mbox{\Hypertarget{group__hmac__functions_gaf76d63347ffb70de4202a771ad767e2d}\label{group__hmac__functions_gaf76d63347ffb70de4202a771ad767e2d}} 
\index{HMAC Functions@{HMAC Functions}!SHA1\_hmac@{SHA1\_hmac}}
\index{SHA1\_hmac@{SHA1\_hmac}!HMAC Functions@{HMAC Functions}}
\doxysubsubsection{\texorpdfstring{SHA1\_hmac()}{SHA1\_hmac()}}
{\footnotesize\ttfamily \mbox{\hyperlink{group__type__conversion__functions_gacf16b4126b795f4b6933ef3425cadae3}{string}} Qore\+::\+S\+H\+A1\+\_\+hmac (\begin{DoxyParamCaption}\item[{data}]{data,  }\item[{data}]{key }\end{DoxyParamCaption})}



Returns the \href{http://en.wikipedia.org/wiki/Secure_Hash_Algorithm}{\texttt{ S\+H\+A1}} based H\+M\+AC of the supplied argument as a hex string. 


\begin{DoxyParams}{Parameters}
{\em data} & the data to process and produce a digest for; the trailing null character is not included in the digest when processing string arguments \\
\hline
{\em key} & a secret passphrase/key\\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
a hex string of the digest (ex\+: {\ttfamily \char`\"{}37a3cc73159aa129b0eb22bbdf4b9309d389f629\char`\"{}})
\end{DoxyReturn}
\begin{DoxyParagraph}{Example\+:}

\begin{DoxyCode}{0}
\DoxyCodeLine{string str = \mbox{\hyperlink{group__hmac__functions_gaf76d63347ffb70de4202a771ad767e2d}{SHA1\_hmac}}(\textcolor{stringliteral}{"Hello There This is a Test -\/ 1234567890"}, \textcolor{stringliteral}{"a key"});}
\DoxyCodeLine{\textcolor{comment}{\# returns "37a3cc73159aa129b0eb22bbdf4b9309d389f629"}}
\end{DoxyCode}

\end{DoxyParagraph}
\begin{DoxyNote}{Note}
Cryptographic weaknesses were discovered in S\+H\+A-\/1, and the standard was no longer approved for most cryptographic uses after 2010.
\end{DoxyNote}

\begin{DoxyExceptions}{Exceptions}
{\em S\+H\+A1-\/\+H\+M\+A\+C-\/\+E\+R\+R\+OR} & error calculating digest (should not normally happen)\\
\hline
\end{DoxyExceptions}
\begin{DoxySeeAlso}{See also}
\mbox{\hyperlink{group__hmac__functions_gaf88021aec5a7048984b0a0e5ce21733d}{hmac()}} 
\end{DoxySeeAlso}
\mbox{\Hypertarget{group__hmac__functions_gaf78d06e41607133b0c053a544b2e92b7}\label{group__hmac__functions_gaf78d06e41607133b0c053a544b2e92b7}} 
\index{HMAC Functions@{HMAC Functions}!SHA224\_hmac@{SHA224\_hmac}}
\index{SHA224\_hmac@{SHA224\_hmac}!HMAC Functions@{HMAC Functions}}
\doxysubsubsection{\texorpdfstring{SHA224\_hmac()}{SHA224\_hmac()}}
{\footnotesize\ttfamily \mbox{\hyperlink{group__type__conversion__functions_gacf16b4126b795f4b6933ef3425cadae3}{string}} Qore\+::\+S\+H\+A224\+\_\+hmac (\begin{DoxyParamCaption}\item[{data}]{data,  }\item[{data}]{key }\end{DoxyParamCaption})}



Returns the \href{http://en.wikipedia.org/wiki/Secure_Hash_Algorithm}{\texttt{ S\+H\+A224}} based H\+M\+AC of the supplied argument as a hex string. 

\begin{DoxyParagraph}{Platform Availability\+:}
\mbox{\hyperlink{group__option__constants_gac2b845ff7b7e953d0ab2c7c0e33154fe}{Qore\+::\+Option\+::\+H\+A\+V\+E\+\_\+\+S\+H\+A224}}
\end{DoxyParagraph}

\begin{DoxyParams}{Parameters}
{\em data} & the data to process and produce a digest for; the trailing null character is not included in the digest when processing string arguments \\
\hline
{\em key} & a secret passphrase/key\\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
a hex string of the digest (ex\+: {\ttfamily \char`\"{}fad5667fa5aa412044555b7e077fced62372fe9c6ce20815609da12c\char`\"{}})
\end{DoxyReturn}
\begin{DoxyParagraph}{Example\+:}

\begin{DoxyCode}{0}
\DoxyCodeLine{string str = \mbox{\hyperlink{group__hmac__functions_gaf78d06e41607133b0c053a544b2e92b7}{SHA224\_hmac}}(\textcolor{stringliteral}{"Hello There This is a Test -\/ 1234567890"}, \textcolor{stringliteral}{"a key"});}
\DoxyCodeLine{\textcolor{comment}{\# returns "fad5667fa5aa412044555b7e077fced62372fe9c6ce20815609da12c"}}
\end{DoxyCode}

\end{DoxyParagraph}

\begin{DoxyExceptions}{Exceptions}
{\em S\+H\+A224-\/\+H\+M\+A\+C-\/\+E\+R\+R\+OR} & error calculating digest (should not normally happen)\\
\hline
\end{DoxyExceptions}
\begin{DoxySeeAlso}{See also}
\mbox{\hyperlink{group__hmac__functions_gaf88021aec5a7048984b0a0e5ce21733d}{hmac()}} 
\end{DoxySeeAlso}
\mbox{\Hypertarget{group__hmac__functions_gaf8c329f83b4b31f2e88b5342d487480b}\label{group__hmac__functions_gaf8c329f83b4b31f2e88b5342d487480b}} 
\index{HMAC Functions@{HMAC Functions}!SHA256\_hmac@{SHA256\_hmac}}
\index{SHA256\_hmac@{SHA256\_hmac}!HMAC Functions@{HMAC Functions}}
\doxysubsubsection{\texorpdfstring{SHA256\_hmac()}{SHA256\_hmac()}}
{\footnotesize\ttfamily \mbox{\hyperlink{group__type__conversion__functions_gacf16b4126b795f4b6933ef3425cadae3}{string}} Qore\+::\+S\+H\+A256\+\_\+hmac (\begin{DoxyParamCaption}\item[{data}]{data,  }\item[{data}]{key }\end{DoxyParamCaption})}



Returns the \href{http://en.wikipedia.org/wiki/Secure_Hash_Algorithm}{\texttt{ S\+H\+A256}} based H\+M\+AC of the supplied argument as a hex string. 

\begin{DoxyParagraph}{Platform Availability\+:}
\mbox{\hyperlink{group__option__constants_ga8bbafb0df946db4960ec53f1739352c2}{Qore\+::\+Option\+::\+H\+A\+V\+E\+\_\+\+S\+H\+A256}}
\end{DoxyParagraph}

\begin{DoxyParams}{Parameters}
{\em data} & the data to process and produce a digest for; the trailing null character is not included in the digest when processing string arguments \\
\hline
{\em key} & a secret passphrase/key\\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
a hex string of the digest (ex\+: {\ttfamily \char`\"{}1c90c21e227712b62019ff831f34cba22c2e70f1a902651ef69a70705ee0f754\char`\"{}})
\end{DoxyReturn}
\begin{DoxyParagraph}{Example\+:}

\begin{DoxyCode}{0}
\DoxyCodeLine{string str = \mbox{\hyperlink{group__hmac__functions_gaf8c329f83b4b31f2e88b5342d487480b}{SHA256\_hmac}}(\textcolor{stringliteral}{"Hello There This is a Test -\/ 1234567890"}, \textcolor{stringliteral}{"a key"});}
\DoxyCodeLine{\textcolor{comment}{\# returns "1c90c21e227712b62019ff831f34cba22c2e70f1a902651ef69a70705ee0f754"}}
\end{DoxyCode}

\end{DoxyParagraph}

\begin{DoxyExceptions}{Exceptions}
{\em S\+H\+A256-\/\+H\+M\+A\+C-\/\+E\+R\+R\+OR} & error calculating digest (should not normally happen)\\
\hline
\end{DoxyExceptions}
\begin{DoxySeeAlso}{See also}
\mbox{\hyperlink{group__hmac__functions_gaf88021aec5a7048984b0a0e5ce21733d}{hmac()}} 
\end{DoxySeeAlso}
\mbox{\Hypertarget{group__hmac__functions_gac028eb1719043ec2461239a0c1de2654}\label{group__hmac__functions_gac028eb1719043ec2461239a0c1de2654}} 
\index{HMAC Functions@{HMAC Functions}!SHA384\_hmac@{SHA384\_hmac}}
\index{SHA384\_hmac@{SHA384\_hmac}!HMAC Functions@{HMAC Functions}}
\doxysubsubsection{\texorpdfstring{SHA384\_hmac()}{SHA384\_hmac()}}
{\footnotesize\ttfamily \mbox{\hyperlink{group__type__conversion__functions_gacf16b4126b795f4b6933ef3425cadae3}{string}} Qore\+::\+S\+H\+A384\+\_\+hmac (\begin{DoxyParamCaption}\item[{data}]{data,  }\item[{data}]{key }\end{DoxyParamCaption})}



Returns the \href{http://en.wikipedia.org/wiki/Secure_Hash_Algorithm}{\texttt{ S\+H\+A384}} based H\+M\+AC of the supplied argument as a hex string. 

\begin{DoxyParagraph}{Platform Availability\+:}
\mbox{\hyperlink{group__option__constants_gaefa59259c4fcbe89eaf1efa5364e0420}{Qore\+::\+Option\+::\+H\+A\+V\+E\+\_\+\+S\+H\+A384}}
\end{DoxyParagraph}

\begin{DoxyParams}{Parameters}
{\em data} & the data to process and produce a digest for; the trailing null character is not included in the digest when processing string arguments \\
\hline
{\em key} & a secret passphrase/key\\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
a hex string of the digest (ex\+: {\ttfamily \char`\"{}e2c253c6dcb050990b4da3cee95cd7b227f43388fa8116f476f59395af295d0d3bb7156ab2fcd0663b0500249a7a0865\char`\"{}})
\end{DoxyReturn}
\begin{DoxyParagraph}{Example\+:}

\begin{DoxyCode}{0}
\DoxyCodeLine{string str = \mbox{\hyperlink{group__hmac__functions_gac028eb1719043ec2461239a0c1de2654}{SHA384\_hmac}}(\textcolor{stringliteral}{"Hello There This is a Test -\/ 1234567890"}, \textcolor{stringliteral}{"a key"});}
\DoxyCodeLine{\textcolor{comment}{\# returns "e2c253c6dcb050990b4da3cee95cd7b227f43388fa8116f476f59395af295d0d3bb7156ab2fcd0663b0500249a7a0865"}}
\end{DoxyCode}

\end{DoxyParagraph}

\begin{DoxyExceptions}{Exceptions}
{\em S\+H\+A384-\/\+H\+M\+A\+C-\/\+E\+R\+R\+OR} & error calculating digest (should not normally happen)\\
\hline
\end{DoxyExceptions}
\begin{DoxySeeAlso}{See also}
\mbox{\hyperlink{group__hmac__functions_gaf88021aec5a7048984b0a0e5ce21733d}{hmac()}} 
\end{DoxySeeAlso}
\mbox{\Hypertarget{group__hmac__functions_ga492a23df5cb989d296c96a2076ef6f8f}\label{group__hmac__functions_ga492a23df5cb989d296c96a2076ef6f8f}} 
\index{HMAC Functions@{HMAC Functions}!SHA512\_hmac@{SHA512\_hmac}}
\index{SHA512\_hmac@{SHA512\_hmac}!HMAC Functions@{HMAC Functions}}
\doxysubsubsection{\texorpdfstring{SHA512\_hmac()}{SHA512\_hmac()}}
{\footnotesize\ttfamily \mbox{\hyperlink{group__type__conversion__functions_gacf16b4126b795f4b6933ef3425cadae3}{string}} Qore\+::\+S\+H\+A512\+\_\+hmac (\begin{DoxyParamCaption}\item[{data}]{data,  }\item[{data}]{key }\end{DoxyParamCaption})}



Returns the \href{http://en.wikipedia.org/wiki/Secure_Hash_Algorithm}{\texttt{ S\+H\+A512}} based H\+M\+AC of the supplied argument as a hex string. 

\begin{DoxyParagraph}{Platform Availability\+:}
\mbox{\hyperlink{group__option__constants_ga361d12136d30719ba4861fd892ee022f}{Qore\+::\+Option\+::\+H\+A\+V\+E\+\_\+\+S\+H\+A512}}
\end{DoxyParagraph}

\begin{DoxyParams}{Parameters}
{\em data} & the data to process and produce a digest for; the trailing null character is not included in the digest when processing string arguments \\
\hline
{\em key} & a secret passphrase/key\\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
a hex string of the digest (ex\+: {\ttfamily \char`\"{}8dcefd7ea3f90ff1c822b5e9547fc36edf78c3e4ce13d47510a212a406bdda1a4094e7ea5ade90e1c736e204d331a814520eba49f3d074e2c261208de07264f6\char`\"{}})
\end{DoxyReturn}
\begin{DoxyParagraph}{Example\+:}

\begin{DoxyCode}{0}
\DoxyCodeLine{string str = \mbox{\hyperlink{group__hmac__functions_ga492a23df5cb989d296c96a2076ef6f8f}{SHA512\_hmac}}(\textcolor{stringliteral}{"Hello There This is a Test -\/ 1234567890"}, \textcolor{stringliteral}{"a key"});}
\DoxyCodeLine{\textcolor{comment}{\# returns "8dcefd7ea3f90ff1c822b5e9547fc36edf78c3e4ce13d47510a212a406bdda1a4094e7ea5ade90e1c736e204d331a814520eba49f3d074e2c261208de07264f6"}}
\end{DoxyCode}

\end{DoxyParagraph}

\begin{DoxyExceptions}{Exceptions}
{\em S\+H\+A512-\/\+H\+M\+A\+C-\/\+E\+R\+R\+OR} & error calculating digest (should not normally happen)\\
\hline
\end{DoxyExceptions}
\begin{DoxySeeAlso}{See also}
\mbox{\hyperlink{group__hmac__functions_gaf88021aec5a7048984b0a0e5ce21733d}{hmac()}} 
\end{DoxySeeAlso}
\mbox{\Hypertarget{group__hmac__functions_gac5ffb694353caa752b069e7b6d018fca}\label{group__hmac__functions_gac5ffb694353caa752b069e7b6d018fca}} 
\index{HMAC Functions@{HMAC Functions}!SHA\_hmac@{SHA\_hmac}}
\index{SHA\_hmac@{SHA\_hmac}!HMAC Functions@{HMAC Functions}}
\doxysubsubsection{\texorpdfstring{SHA\_hmac()}{SHA\_hmac()}}
{\footnotesize\ttfamily \mbox{\hyperlink{group__type__conversion__functions_gacf16b4126b795f4b6933ef3425cadae3}{string}} Qore\+::\+S\+H\+A\+\_\+hmac (\begin{DoxyParamCaption}\item[{data}]{data,  }\item[{data}]{key }\end{DoxyParamCaption})}



Returns the \href{http://en.wikipedia.org/wiki/Secure_Hash_Algorithm}{\texttt{ S\+HA}} based H\+M\+AC of the supplied argument as a hex string. 


\begin{DoxyParams}{Parameters}
{\em data} & the data to process and produce a digest for; the trailing null character is not included in the digest when processing string arguments \\
\hline
{\em key} & a secret passphrase/key\\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
a hex string of the digest (ex\+: {\ttfamily \char`\"{}0ad47c8d36dc4606d52f7e4cbd144ef2fda492a0\char`\"{}})
\end{DoxyReturn}
\begin{DoxyParagraph}{Example\+:}

\begin{DoxyCode}{0}
\DoxyCodeLine{string str = \mbox{\hyperlink{group__hmac__functions_gac5ffb694353caa752b069e7b6d018fca}{SHA\_hmac}}(\textcolor{stringliteral}{"Hello There This is a Test -\/ 1234567890"}, \textcolor{stringliteral}{"a key"});}
\DoxyCodeLine{\textcolor{comment}{\# returns "0ad47c8d36dc4606d52f7e4cbd144ef2fda492a0"}}
\end{DoxyCode}

\end{DoxyParagraph}
\begin{DoxyNote}{Note}
S\+H\+A/\+S\+H\+A0 was withdrawn shortly after publication due to an undisclosed \char`\"{}significant flaw\char`\"{} and replaced by the slightly revised version S\+H\+A-\/1.
\end{DoxyNote}

\begin{DoxyExceptions}{Exceptions}
{\em S\+H\+A-\/\+H\+M\+A\+C-\/\+E\+R\+R\+OR} & error calculating digest (should not normally happen)\\
\hline
\end{DoxyExceptions}
\begin{DoxySeeAlso}{See also}
\mbox{\hyperlink{group__hmac__functions_gaf88021aec5a7048984b0a0e5ce21733d}{hmac()}} 
\end{DoxySeeAlso}
