# ACL GENPASS

> Generate a random password as hexadecimal digits from the system's cryptographic generator.

URL: https://docs.hotkv.com/commands/acl-genpass/

```
ACL GENPASS [bits]
```

- Group: ACL
- Complexity: O(N) where N is the number of bits
- HotKV Cloud: all plans
- On-Premise: no license needed

`ACL GENPASS` returns a random password made of lowercase hexadecimal
digits, taken from the operating system's cryptographically secure random
generator. By default it has 256 bits of randomness, 64 characters. With
`bits`, you get that many bits, rounded up to a whole number of hex digits
(4 bits each). Nothing is stored: pass the result to
[ACL SETUSER](https://docs.hotkv.com/commands/acl-setuser/index.md) with `>password`.

## Options

| Argument | Meaning |
| --- | --- |
| `bits` | Bits of randomness, from 1 to 4096 (default 256). |

## Return value

| Case | RESP2 | RESP3 |
| --- | --- | --- |
| Success | Bulk string: the password | Bulk string |
| `bits` not an integer | Error `ERR value is not an integer or out of range` | Same error |
| `bits` outside 1 to 4096 | Error `ERR ACL GENPASS argument must be the number of bits for the output password, a positive number up to 4096` | Same error |

## Examples

```
127.0.0.1:6379> ACL GENPASS
"6a1e5774f0c9831097d0f74a8e2072ade4869561a12db025038ac7e9ccfc7153"
127.0.0.1:6379> ACL GENPASS 32
"9f3c07b2"
127.0.0.1:6379> ACL GENPASS 5
"e4"
```

## Compatibility

Same as Redis 7 and Valkey 8.

## See also

[ACL SETUSER](https://docs.hotkv.com/commands/acl-setuser/index.md)