Security is important part of the today IT and gains more respect from IT world. Hashing is a security measure to protect and check our data. In this tutorial we will look how to use hash with tables and strings.
安全性是当今IT的重要组成部分,并得到了IT世界的更多尊重。 散列是一种安全措施,可以保护和检查我们的数据。 在本教程中,我们将研究如何将哈希与表和字符串一起使用。
什么是哈希 (What is Hash)
Hash is a function where provided data will be converted into another expressions format and can not be recovered back with normal functions.
散列是一种函数,在此函数中,提供的数据将转换为另一种表达式格式,并且无法使用常规函数恢复。
MD5 (MD5)
MD5 is very popular hashing algorithm created long time ago. It is very popular in IT world. But it have security issues which makes it unsecure for public usage.
MD5是很久以前创建的非常流行的哈希算法。 它在IT世界中非常流行。 但是它具有安全性问题,因此对于公众使用来说是不安全的。
SHA1 / SHA224 / SHA256 / SHA384 / SHA512 (SHA1 / SHA224 / SHA256 / SHA384 / SHA512)
SHA is a hash algorithm family where different size of hashes can be created. We can create hash from 128 byte to 512 byte. SHA is recent and popular algorithm which can be used securely in our applications and system.
SHA是一个哈希算法系列,可以在其中创建不同大小的哈希。 我们可以创建从128字节到512字节的哈希。 SHA是最近流行的算法,可以在我们的应用程序和系统中安全使用。
的OpenSSL (OpenSSL)
OpenSSL is popular library which provides cryptographic functions. We can use different encryption and hash algorithms. There is also OpenSSL library and module for Python too.
OpenSSL是流行的库,提供加密功能。 我们可以使用不同的加密和哈希算法。 还有用于Python的OpenSSL库和模块。
How To Install and Use OpenSSL Library In Python Applications?
Hashlib模块 (Hashlib Module)
Hashlib is the builtin library provided by Python. This library mainly provides diffent type of hash libraries those we have explained previously. We can import hashlib
module like below.
Hashlib是Python提供的内置库。 这个库主要提供了我们前面已经解释过的哈希库的不同类型。 我们可以像下面那样导入hashlib
模块。
import hashlib