A Challenge Handshake Authentication Protocol (CHAP) packet consists of the following fields:
- A one-octet Code field
- A one octet Identifier field, which helps to match challenges to responses
- A two-octet Length field, which indicates the length of the packet
- One or more fields that are determined by the Code field
A Challenge packet has a Code field that is set to a value of 1. It also has the following additional fields:
- A one octet Value-Size field, which indicates the length of the Value field
- A variable-length Challenge Value field, which contains a variable, unique stream of octets
- A variable-length Name field, which identifies the name of the transmitting device
A Response packet has a Code field that is set to a value of 2. It also has the following additional fields:
- A one-octet Value-Size field, which indicates the length of the Response Value field
- A variable-length Response Value field, which contains a concatenated one-way hash of the ID, the secret key, and the Challenge Value
- A variable-length Name field, which identifies the name of the transmitting device
A Success packet has a Code field that is set to a value of 3, and a Failure packet has a Code field that is set to a value of 4. In addition to the standard fields, the Success packet and the Failure packet have a variable-length Message field, which displays a success or failure message, typically in human-readable ASCII characters.