Skip to main content

Introduction

The hash_md5 function returns the MD5 hash of a scalar value as a 32-character hexadecimal string. Use it to anonymize personally identifiable information while preserving joinability, detect duplicate records across datasets, or generate consistent bucket keys for grouping. MD5 produces a 128-bit digest that’s fast to compute. It isn’t suitable for cryptographic security, but is appropriate for data deduplication, checksumming, and non-security anonymization tasks. For security-sensitive use cases, use hash_sha256 or hash_sha512 instead.

For users of other query languages

If you come from other query languages, this section explains how to adjust your existing queries to achieve the same results in APL.
Splunk provides the md5(X) function that returns a 32-character hex string. APL’s hash_md5 works the same way.
... | eval hashed_id = md5(id)
ANSI SQL has no standard MD5 function, but most databases provide one: MySQL’s MD5(), PostgreSQL’s md5(). APL’s hash_md5 returns the same 32-character lowercase hex digest.
SELECT MD5(id) AS hashed_id FROM sample_http_logs

Usage

Syntax

hash_md5(source)

Parameters

NameTypeRequiredDescription
sourcescalarYesThe value to hash. APL converts it to a string before hashing.

Returns

The MD5 hash of source as a 32-character lowercase hexadecimal string.

Use case examples

Anonymize user IDs before counting requests per user to protect PII in shared dashboards.Query
['sample-http-logs']
| extend hashed_id = hash_md5(id)
| summarize request_count = count() by hashed_id
| top 5 by request_count
Run in PlaygroundOutput
hashed_idrequest_count
b980a9c041dbd33d5893fad65d33284b128
3f7a2c1e8d4b6f9e0c5d3a7b2e4f8c1d97
9c2e4a6f1d3b7e8c5a2f4d6b9e1c3a7f85
1a3c5e7b9f2d4a6c8e0b3f5d7a9c1e3b74
7f9e1c3a5b2d4f6e8c0a3b5d7e9f1c3a69
The query replaces raw user IDs with MD5 hashes before aggregating, so the busiest users are visible without exposing their original identifiers.
  • hash_sha1: Returns a 40-character SHA-1 hex digest. Use hash_sha1 when you need a larger digest than MD5 but legacy compatibility matters.
  • hash_sha256: Returns a 64-character SHA-256 hex digest. Use hash_sha256 for security-sensitive hashing.
  • hash_sha512: Returns a 128-character SHA-512 hex digest for maximum hash strength.
  • hash: Returns a signed 64-bit integer hash. Use hash when you need a compact numeric key rather than a hex string.