md5

md5

(PHP 4, PHP 5)

md5计算字符串的 MD5 散列值

说明

string md5 ( string $str [, bool $raw_output = false ] )

使用 » RSA 数据安全公司的 MD5 报文算法计算 str 的 MD5 散列值。

参数

str

原始字符串。

raw_output

如果可选的 raw_output 被设置为 TRUE,那么 MD5 报文摘要将以原始的 16 位二进制格式返回。

返回值

以 32 字符十六进制数字形式返回散列值。

更新日志

版本 说明
5.0.0 新增 raw_output 参数。

范例

Example #1 md5() 范例

<?php
$str 
'apple';

if (
md5($str) === '1f3870be274f6c49b3e31a0c6728957f') {
    echo 
"Would you like a green or red apple?";
}
?>

参见

  • md5_file() - 计算指定文件的 MD5 散列值
  • sha1_file() - 计算文件的 sha1 散列值
  • crc32() - 计算一个字符串的 crc32 多项式
  • sha1() - 计算字符串的 sha1 散列值
  • hash() - Generate a hash value (message digest)

  • addcslashes
  • addslashes
  • bin2hex
  • chop
  • chr
  • chunk_split
  • convert_cyr_string
  • convert_uudecode
  • convert_uuencode
  • count_chars
  • crc32
  • crypt
  • echo
  • explode
  • fprintf
  • get_html_translation_table
  • hebrev
  • hebrevc
  • hex2bin
  • htmlentities
  • htmlspecialchars
  • htmlspecialchars_decode
  • html_entity_decode
  • implode
  • join
  • levenshtein
  • localeconv
  • ltrim
  • md5
  • md5_file
  • metaphone
  • money_format
  • nl2br
  • nl_langinfo
  • number_format
  • ord
  • parse_str
  • print
  • printf
  • quoted_printable_decode
  • quoted_printable_encode
  • quotemeta
  • rtrim
  • setlocale
  • sha1
  • sha1_file
  • similar_text
  • soundex
  • sprintf
  • sscanf
  • strcasecmp
  • strchr
  • strcmp
  • strcoll
  • strcspn
  • stripcslashes
  • stripos
  • stripslashes
  • strip_tags
  • stristr
  • strlen
  • strnatcasecmp
  • strnatcmp
  • strncasecmp
  • strncmp
  • strpbrk
  • strpos
  • strrchr
  • strrev
  • strripos
  • strrpos
  • strspn
  • strstr
  • strtok
  • strtolower
  • strtoupper
  • strtr
  • str_getcsv
  • str_ireplace
  • str_pad
  • str_repeat
  • str_replace
  • str_rot13
  • str_shuffle
  • str_split
  • str_word_count
  • substr
  • substr_compare
  • substr_count
  • substr_replace
  • trim
  • ucfirst
  • ucwords
  • vfprintf
  • vprintf
  • vsprintf
  • wordwrap
  • PHP MySQL HTML CSS JavaScript MSSQL AJAX .NET JSP Linux Mac ASP 服务器 SQL jQuery C# C++ java Android IOS oracle MongoDB SQLite wamp 交通频道