QMessageAuthenticationCode: use SHA-256 instead of insecure SHA-1 in doc sippet
Pick-to: 6.5 Change-Id: I5b39229abbb3e21d90fd83f5f3bcbe1afe609526 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
This commit is contained in:
parent
2a2fc4d16d
commit
8de0262ded
@ -14,12 +14,12 @@ int main(int argc, char *argv[])
|
||||
//! [0]
|
||||
|
||||
//! [1]
|
||||
QMessageAuthenticationCode code(QCryptographicHash::Sha1, key);
|
||||
QMessageAuthenticationCode code(QCryptographicHash::Sha256, key);
|
||||
code.addData(message);
|
||||
code.result().toHex(); // returns "de7c9b85b8b78aa6bc8a7a36f70a90701c9db4d9"
|
||||
code.result().toHex(); // returns "f7bc83f430538424b13298e6aa6fb143ef4d59a14946175997479dbc2d1a3cd8"
|
||||
//! [1]
|
||||
|
||||
//! [2]
|
||||
QMessageAuthenticationCode::hash(message, key, QCryptographicHash::Sha1).toHex();
|
||||
QMessageAuthenticationCode::hash(message, key, QCryptographicHash::Sha256).toHex();
|
||||
//! [2]
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user