Home / Search/ Language Reference/ Functions/ Scalar Functions/ Hash Functions/hash_sha1

hash_sha1

The hash_sha1 function returns a SHA1 hash value for the input value.

Syntax

    hash_sha1( Source )

Arguments

  • Source: The value to be hashed.

Returns

The SHA1 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).

Examples

  • h1=hash_sha1("World")
  • h2=hash_sha1(datetime(2020-01-01))

Aggregate by hash

This example uses the hash_sha1 function to aggregate StormEvents based on the State’s SHA1 hash value.

dataset=StormEvents
| summarize StormCount = count() by State, StateHash=hash_sha1(State)
| top 5 by StormCount desc

Returns the following:

StateStateHashStormCount
TEXAS3128d805194d4e6141766cc846778eeacb12e3ea4701
KANSASea926e17098148921e472b1a760cd5a8117e84d63166
IOWAcacf86ec119cfd5b574bde5b59604774de3273db2337
ILLINOIS03740763b16dae9d799097f51623fe635d8c48522022
MISSOURI26d938907240121b54d9e039473dacc96e712f612016