# DIGEST

> Return the digest of a string value, the fingerprint that the IFDEQ and IFDNE conditions compare.

URL: https://docs.hotkv.com/commands/digest/

```
DIGEST key
```

- Group: String
- Complexity: O(N) where N is the length of the string
- HotKV Cloud: all plans
- On-Premise: no license needed

`DIGEST` returns a 64-bit fingerprint of the string stored at `key`, written
as 16 hexadecimal digits. It is the digest that Redis 8.10 returns for the same
string. Two strings with the same value have the same digest, so you can compare a value without sending
it, and pass the digest to the `IFDEQ` and `IFDNE` conditions of
[SET](https://docs.hotkv.com/commands/set/index.md) and [DELEX](https://docs.hotkv.com/commands/delex/index.md).

## Return value

A bulk string of 16 hexadecimal digits, or nil (RESP2) or null (RESP3) when
the key does not exist. A key that holds another type is
`WRONGTYPE Operation against a key holding the wrong kind of value`. No key,
or an extra argument, is `ERR wrong number of arguments for 'digest' command`.

## Examples

```
127.0.0.1:6379> SET session:1 token-a
OK
127.0.0.1:6379> DIGEST session:1
"f2c369a318423e95"
127.0.0.1:6379> DIGEST missing
(nil)
127.0.0.1:6379> LPUSH jobs a
(integer) 1
127.0.0.1:6379> DIGEST jobs
(error) WRONGTYPE Operation against a key holding the wrong kind of value
```

## Compatibility

A Redis 8.4 command. It is not the same as `DEBUG DIGEST`, which fingerprints
the whole dataset.

## See also

[DELEX](https://docs.hotkv.com/commands/delex/index.md), [SET](https://docs.hotkv.com/commands/set/index.md), [GET](https://docs.hotkv.com/commands/get/index.md)