Skip to content

PythonQt.QtCore.QMessageAuthenticationCode

QMessageAuthenticationCode

PythonQtInstanceWrapper object

Native bases: PythonQtInstanceWrapper

Supplemental documentation: Qt 5 reference:

Detailed Description

QMessageAuthenticationCode supports all cryptographic hashes which are supported by QCryptographicHash.

To generate message authentication code, pass hash algorithm QCryptographicHash::Algorithm to constructor, then set key and message by setKey() and addData() functions. Result can be acquired by result() function.

    QByteArray key = "key";
    QByteArray message = "The quick brown fox jumps over the lazy dog";
    ...
    QMessageAuthenticationCode code(QCryptographicHash::Sha1);
    code.setKey(key);
    code.addData(message);
    code.result().toHex();      // returns "de7c9b85b8b78aa6bc8a7a36f70a90701c9db4d9"

Alternatively, this effect can be achieved by providing message, key and method to hash() method.

    QMessageAuthenticationCode::hash(message, key, QCryptographicHash::Sha1).toHex();

Source: https://doc.qt.io/archives/qt-5.15/qmessageauthenticationcode.html

Complete member index

Every captured member retains its own identity. Identical captured declaration text is linked once; this does not establish native inheritance or interchangeable objects.

Member Kind Signature Summary
__init__ function (self, *args: Any, **kwargs: Any) -> None Native constructor; consult class documentation for supported overloads. (shared captured text)
addData function (self, data: Any, length: Any) -> bool X.addData(data, length) -> bool
className function (self, *args: Any, **kwargs: Any) -> Any Return the classname of the object (shared captured text)
delete function (self, *args: Any, **kwargs: Any) -> Any Deletes the C++ object (at your own risk, my friend!) (shared captured text)
hash function (self, message: Any, key: Any, method: Any) -> Any X.hash(message, key, method) -> PythonQt.QtCore.QByteArray
help function (self, *args: Any, **kwargs: Any) -> Any Shows the help of available methods for this class (shared captured text)
inherits function (self, *args: Any, **kwargs: Any) -> Any Returns if the class inherits or is of given type name (shared captured text)
reset function (self) -> None Resets message data.
result function (self) -> Any X.result() -> PythonQt.QtCore.QByteArray
setKey function (self, key: Any) -> None Sets secret key.