This shows you the differences between two versions of the page.
Next revision | Previous revision | ||
uphp:functions:sha1 [2017/05/16 06:14] admin created |
uphp:functions:sha1 [2019/08/16 09:42] admin [See Also] |
||
---|---|---|---|
Line 1: | Line 1: | ||
- | ====== sha1($str) | + | ======sha1====== |
- | Calculate the sha1 hash of a string. | + | |
- | For more information on SHA1, see the [[https://en.wikipedia.org/wiki/ | + | < |
- | Example: | + | Calculate the SHA1 hash of a < |
- | <code php> | + | ====Description==== |
- | < | + | |
- | <? | + | |
- | // call the function with this: sha1.cgi? | + | |
- | // sha1 hash value for secretykey | + | <well size=" |
- | $hash = "9885F8AF04289135DF259E34BD22D17FE45EA81E"; | + | <span style=" |
+ | <span style=" | ||
+ | <span style=" | ||
+ | <span style=" | ||
+ | <span style="color:black">) | ||
+ | </ | ||
- | if (sha1($_GET[' | + | This can be used for cryptography or just for checksum calculations. |
- | print(" | + | |
- | } | + | |
- | ?> | + | For more information on SHA1, see this [[https:// |
- | </pre> | + | |
+ | ====Parameter==== | ||
+ | |||
+ | < | ||
+ | |||
+ | ====Return Values==== | ||
+ | |||
+ | < | ||
+ | |||
+ | ====Example==== | ||
+ | |||
+ | <code php> | ||
+ | <? | ||
+ | // Name this example and call it with this: sha1.cgi? | ||
+ | |||
+ | // SHA1 hash value for " | ||
+ | $hash=" | ||
+ | |||
+ | if (sha1($_GET[' | ||
+ | print(" | ||
+ | } | ||
+ | ?> | ||
</ | </ | ||
+ | |||
+ | ====See Also==== | ||
+ | |||
+ | [[md5()]] - Calculate the MD5 hash of a < | ||
+ | |||
+ | [[md5_file()]] - Calculate the MD5 hash of a file | ||
+ | |||
+ | [[hash_hmac()]] - Calculate the hash of a string | ||
+ | |||
+ | [[aes_decrypt()]] - Decrypt a string using the AES algorithm | ||
+ | |||
+ | [[aes_encrypt()]] - Encrypt a string using the AES algorithm |