<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE html> <html lang="en"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <!-- qpassworddigestor.cpp --> <title>QPasswordDigestor Namespace | Qt Network 5.12.6</title> <link rel="stylesheet" type="text/css" href="style/offline-simple.css" /> <script type="text/javascript"> document.getElementsByTagName("link").item(0).setAttribute("href", "style/offline.css"); // loading style sheet breaks anchors that were jumped to before // so force jumping to anchor again setTimeout(function() { var anchor = location.hash; // need to jump to different anchor first (e.g. none) location.hash = "#"; setTimeout(function() { location.hash = anchor; }, 0); }, 0); </script> </head> <body> <div class="header" id="qtdocheader"> <div class="main"> <div class="main-rounded"> <div class="navigationbar"> <table><tr> <td >Qt 5.12</td><td ><a href="qtnetwork-index.html">Qt Network</a></td><td >QPasswordDigestor Namespace</td></tr></table><table class="buildversion"><tr> <td id="buildversion" width="100%" align="right"><a href="qtnetwork-index.html">Qt 5.12.6 Reference Documentation</a></td> </tr></table> </div> </div> <div class="content"> <div class="line"> <div class="content mainContent"> <div class="sidebar"> <div class="toc"> <h3><a name="toc">Contents</a></h3> <ul> <li class="level1"><a href="#functions">Functions</a></li> <li class="level1"><a href="#details">Detailed Description</a></li> </ul> </div> <div class="sidebar-content" id="sidebar-content"></div></div> <h1 class="title">QPasswordDigestor Namespace</h1> <!-- $$$QPasswordDigestor-brief --> <p>The <a href="qpassworddigestor.html">QPasswordDigestor</a> namespace contains functions which you can use to generate hashes or keys. <a href="#details">More...</a></p> <!-- @@@QPasswordDigestor --> <div class="table"><table class="alignedsummary"> <tr><td class="memItemLeft rightAlign topAlign"> Header:</td><td class="memItemRight bottomAlign"> <span class="preprocessor">#include <QPasswordDigestor></span> </td></tr><tr><td class="memItemLeft rightAlign topAlign"> qmake:</td><td class="memItemRight bottomAlign"> QT += network</td></tr></table></div><ul> </ul> <a name="functions"></a> <h2 id="functions">Functions</h2> <div class="table"><table class="alignedsummary"> <tr><td class="memItemLeft rightAlign topAlign"> QByteArray </td><td class="memItemRight bottomAlign"><b><a href="qpassworddigestor.html#deriveKeyPbkdf1">deriveKeyPbkdf1</a></b>(QCryptographicHash::Algorithm <i>algorithm</i>, const QByteArray &<i>data</i>, const QByteArray &<i>salt</i>, int <i>iterations</i>, quint64 <i>dkLen</i>)</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> QByteArray </td><td class="memItemRight bottomAlign"><b><a href="qpassworddigestor.html#deriveKeyPbkdf2">deriveKeyPbkdf2</a></b>(QCryptographicHash::Algorithm <i>algorithm</i>, const QByteArray &<i>data</i>, const QByteArray &<i>salt</i>, int <i>iterations</i>, quint64 <i>dkLen</i>)</td></tr> </table></div> <a name="details"></a> <!-- $$$QPasswordDigestor-description --> <div class="descr"> <h2 id="details">Detailed Description</h2> <p>The <a href="qpassworddigestor.html">QPasswordDigestor</a> namespace contains functions which you can use to generate hashes or keys.</p> </div> <!-- @@@QPasswordDigestor --> <div class="func"> <h2>Function Documentation</h2> <!-- $$$deriveKeyPbkdf1[overload1]$$$deriveKeyPbkdf1QCryptographicHash::AlgorithmconstQByteArray&constQByteArray&intquint64 --> <h3 class="fn" id="deriveKeyPbkdf1"><a name="deriveKeyPbkdf1"></a><span class="type"><a href="../qtcore/qbytearray.html">QByteArray</a></span> QPasswordDigestor::<span class="name">deriveKeyPbkdf1</span>(<span class="type"><a href="../qtcore/qcryptographichash.html#Algorithm-enum">QCryptographicHash::Algorithm</a></span> <i>algorithm</i>, const <span class="type"><a href="../qtcore/qbytearray.html">QByteArray</a></span> &<i>data</i>, const <span class="type"><a href="../qtcore/qbytearray.html">QByteArray</a></span> &<i>salt</i>, <span class="type">int</span> <i>iterations</i>, <span class="type"><a href="../qtcore/qtglobal.html#quint64-typedef">quint64</a></span> <i>dkLen</i>)</h3> <p>Returns a hash computed using the PBKDF1-algorithm as defined in <a href="https://tools.ietf.org/html/rfc8018#section-5.1">RFC 8018</a>.</p> <p>The function takes the <i>data</i> and <i>salt</i>, and then hashes it repeatedly for <i>iterations</i> iterations using the specified hash <i>algorithm</i>. If the resulting hash is longer than <i>dkLen</i> then it is truncated before it is returned.</p> <p>This function only supports SHA-1 and MD5! The max output size is 160 bits (20 bytes) when using SHA-1, or 128 bits (16 bytes) when using MD5. Specifying a value for <i>dkLen</i> which is greater than this results in a warning and an empty <a href="../qtcore/qbytearray.html">QByteArray</a> is returned. To programmatically check this limit you can use <a href="../qtcore/qcryptographichash.html#hashLength">QCryptographicHash::hashLength</a>. Furthermore: the <i>salt</i> must always be 8 bytes long!</p> <p><b>Note: </b>This function is provided for use with legacy applications and all new applications are recommended to use <a href="qpassworddigestor.html#deriveKeyPbkdf2">PBKDF2</a>.</p><p>This function was introduced in Qt 5.12.</p> <p><b>See also </b><a href="qpassworddigestor.html#deriveKeyPbkdf2">deriveKeyPbkdf2</a>, <a href="../qtcore/qcryptographichash.html">QCryptographicHash</a>, and <a href="../qtcore/qcryptographichash.html#hashLength">QCryptographicHash::hashLength</a>.</p> <!-- @@@deriveKeyPbkdf1 --> <!-- $$$deriveKeyPbkdf2[overload1]$$$deriveKeyPbkdf2QCryptographicHash::AlgorithmconstQByteArray&constQByteArray&intquint64 --> <h3 class="fn" id="deriveKeyPbkdf2"><a name="deriveKeyPbkdf2"></a><span class="type"><a href="../qtcore/qbytearray.html">QByteArray</a></span> QPasswordDigestor::<span class="name">deriveKeyPbkdf2</span>(<span class="type"><a href="../qtcore/qcryptographichash.html#Algorithm-enum">QCryptographicHash::Algorithm</a></span> <i>algorithm</i>, const <span class="type"><a href="../qtcore/qbytearray.html">QByteArray</a></span> &<i>data</i>, const <span class="type"><a href="../qtcore/qbytearray.html">QByteArray</a></span> &<i>salt</i>, <span class="type">int</span> <i>iterations</i>, <span class="type"><a href="../qtcore/qtglobal.html#quint64-typedef">quint64</a></span> <i>dkLen</i>)</h3> <p>Derive a key using the PBKDF2-algorithm as defined in <a href="https://tools.ietf.org/html/rfc8018#section-5.2">RFC 8018</a>.</p> <p>This function takes the <i>data</i> and <i>salt</i>, and then applies HMAC-X, where the X is <i>algorithm</i>, repeatedly. It internally concatenates intermediate results to the final output until at least <i>dkLen</i> amount of bytes have been computed and it will execute HMAC-X <i>iterations</i> times each time a concatenation is required. The total number of times it will execute HMAC-X depends on <i>iterations</i>, <i>dkLen</i> and <i>algorithm</i> and can be calculated as <code>iterations * ceil(dkLen / QCryptographicHash::hashLength(algorithm))</code>.</p> <p>This function was introduced in Qt 5.12.</p> <p><b>See also </b><a href="qpassworddigestor.html#deriveKeyPbkdf1">deriveKeyPbkdf1</a>, <a href="../qtcore/qmessageauthenticationcode.html">QMessageAuthenticationCode</a>, and <a href="../qtcore/qcryptographichash.html">QCryptographicHash</a>.</p> <!-- @@@deriveKeyPbkdf2 --> </div> </div> </div> </div> </div> </div> <div class="footer"> <p> <acronym title="Copyright">©</acronym> 2019 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners.<br/> The documentation provided herein is licensed under the terms of the <a href="http://www.gnu.org/licenses/fdl.html">GNU Free Documentation License version 1.3</a> as published by the Free Software Foundation.<br/> Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners. </p> </div> </body> </html>