QCryptographicHashclass provides a way to generate cryptographic hashes. 更多 …
def
hash
(data, method)
def
hashLength
(method)
QCryptographicHashcan be used to generate cryptographic hashes of binary or text data.参考文档编制中
Algorithm枚举,支持的算法列表。
QCryptographicHash
(
方法
)
¶
- param method
Algorithm
构造可用于从数据创建加密哈希的对象,使用
方法
.
PySide2.QtCore.QCryptographicHash.
Algorithm
¶
注意
In Qt versions before 5.9, when asked to generate a SHA3 hash sum,
QCryptographicHash
actually calculated Keccak. If you need compatibility with SHA-3 hashes produced by those versions of Qt, use the
Keccak_
enumerators. Alternatively, if source compatibility is required, define the macro
QT_SHA3_KECCAK_COMPAT
.
|
常量 |
描述 |
|---|---|
|
QCryptographicHash.Md4 |
生成 MD4 哈希和 |
|
QCryptographicHash.Md5 |
生成 MD5 哈希和 |
|
QCryptographicHash.Sha1 |
生成 SHA-1 哈希和 |
|
QCryptographicHash.Sha224 |
Generate an SHA-224 hash sum (SHA-2). Introduced in Qt 5.0 |
|
QCryptographicHash.Sha256 |
Generate an SHA-256 hash sum (SHA-2). Introduced in Qt 5.0 |
|
QCryptographicHash.Sha384 |
Generate an SHA-384 hash sum (SHA-2). Introduced in Qt 5.0 |
|
QCryptographicHash.Sha512 |
Generate an SHA-512 hash sum (SHA-2). Introduced in Qt 5.0 |
|
QCryptographicHash.Sha3_224 |
Generate an SHA3-224 hash sum. Introduced in Qt 5.1 |
|
QCryptographicHash.Sha3_256 |
Generate an SHA3-256 hash sum. Introduced in Qt 5.1 |
|
QCryptographicHash.Sha3_384 |
Generate an SHA3-384 hash sum. Introduced in Qt 5.1 |
|
QCryptographicHash.Sha3_512 |
Generate an SHA3-512 hash sum. Introduced in Qt 5.1 |
|
QCryptographicHash.Keccak_224 |
Generate a Keccak-224 hash sum. Introduced in Qt 5.9.2 |
|
QCryptographicHash.Keccak_256 |
Generate a Keccak-256 hash sum. Introduced in Qt 5.9.2 |
|
QCryptographicHash.Keccak_384 |
Generate a Keccak-384 hash sum. Introduced in Qt 5.9.2 |
|
QCryptographicHash.Keccak_512 |
Generate a Keccak-512 hash sum. Introduced in Qt 5.9.2 |
PySide2.QtCore.QCryptographicHash.
addData
(
device
)
¶
device
–
QIODevice
bool
读取数据,从打开
QIODevice
device
直到它结束并哈希为止。返回
true
若读取是成功的。
PySide2.QtCore.QCryptographicHash.
addData
(
data
)
¶
data
–
QByteArray
PySide2.QtCore.QCryptographicHash.
addData
(
data
)
¶
data – str
Adds the first
length
chars of
data
to the cryptographic hash.
PySide2.QtCore.QCryptographicHash.
hash
(
data
,
方法
)
¶
data
–
QByteArray
方法
–
Algorithm
Returns the hash of
data
使用
方法
.
PySide2.QtCore.QCryptographicHash.
hashLength
(
方法
)
¶
方法
–
Algorithm
int
Returns the size of the output of the selected hash
方法
in bytes.
PySide2.QtCore.QCryptographicHash.
reset
(
)
¶
重置对象。
PySide2.QtCore.QCryptographicHash.
result
(
)
¶
返回最终的哈希值。
另请参阅