SHA algorithms are similar to MD5 in php encryption technology. SHA is called SecureHashAlgorithm (Secure Hash Algorithm). The sha1 () function provided by PHP uses SHA algorithm. SHA algorithm is similar to MD5 in php encryption technology. SHA is called Secure Hash Algorithm (Secure Hash Algorithm). The sha1 () function provided by PHP uses the SHA Algorithm. the Function syntax is as follows:
String sha 1 (string str [, bool raw_output])
The function returns a 40-bit hexadecimal number. if the raw_output parameter is true, a 20-bit binary number is returned.
The default value of raw_output is false.
Note:
Sha is followed by 1 in Arabic numerals (1.2.3) rather than 1 (L.
Example of using the sha1 () function for encryption:
In this example, MD5 and SHA encryption operations are performed on a string respectively. the instance code is as follows:
Figure shows the contrast effect between MD5 encryption and SHA encryption.
The above is the details about encryption using the sha1 () function-php encryption technology. For more information, see other related articles in the first PHP community!