hash_md5()hash_md5()

返回输入值的 MD5 哈希值。Returns an MD5 hash value for the input value.

语法Syntax

hash_md5(source)hash_md5(source)

参数Arguments

  • source:要进行哈希处理的值。source: The value to be hashed.

返回Returns

给定标量的 MD5 哈希值编码为十六进制字符串(其中的每两个字符都表示 0 到 255 之间的一个十六进制数字)。The MD5 hash value of the given scalar, encoded as a hex string (a string of characters, each two of which represent a single Hex number between 0 and 255).

警告

此函数 (MD5) 所用的算法可确保不会在以后修改,但计算起来非常复杂。The algorithm used by this function (MD5) is guaranteed to not be modified in the future, but is very complex to calculate. 建议需要在单个查询期间使用“轻量级”哈希函数的用户改为使用函数 hash()Users that need a "lightweight" hash function for the duration of a single query are advised to use the function hash() instead.

示例Examples

print 
h1=hash_md5("World"),
h2=hash_md5(datetime(2020-01-01))
h1h1 h2h2
f5a7924e621e84c9280a9a27e1bcb7f6f5a7924e621e84c9280a9a27e1bcb7f6 786c530672d1f8db31fee25ea8a9390b786c530672d1f8db31fee25ea8a9390b

以下示例使用 hash_md5() 函数根据 State 的 MD5 哈希值聚合 StormEvents。The following example uses the hash_md5() function to aggregate StormEvents based on State's MD5 hash value.

StormEvents
| summarize StormCount = count() by State, StateHash=hash_md5(State)
| top 5 by StormCount
状态State StateHashStateHash StormCountStormCount
德克萨斯TEXAS 3b00dbe6e07e7485a1c12d36c8e9910a3b00dbe6e07e7485a1c12d36c8e9910a 47014701
KANSASKANSAS e1338d0ac8be43846cf9ae967bd02e7fe1338d0ac8be43846cf9ae967bd02e7f 31663166
衣阿华州IOWA 6d4a7c02942f093576149db764d4e2d26d4a7c02942f093576149db764d4e2d2 23372337
ILLINOISILLINOIS 8c00d9e0b3fcd55aed5657e42cc40cf18c00d9e0b3fcd55aed5657e42cc40cf1 20222022
MISSOURIMISSOURI 2d82f0c963c0763012b2539d469e50082d82f0c963c0763012b2539d469e5008 20162016