EXT0010: Encrypted Gamma
Ta treść nie jest jeszcze dostępna w Twoim języku.
- Extension dependencies: none
- Document status: Approved (2020-02-01)
Full encryption using Gamma algorithm with single key buffer.
Algorithm
Section titled “Algorithm”Uses 40-byte key, encrypts in 16-byte blocks. For each block:
- Calculate SHA-1 hash of key (use first 16 bytes)
- After each block, new key = SHA-1 hash (20 bytes) + data block before encryption (16 bytes) + next block number (4 bytes)
Block encryption (16 bytes):
- Permutation: For each byte 0-15 of key hash, split into tetrads (nibbles). Swap high tetrad of data block (at hash high nibble index) with high tetrad of next byte (at hash byte index). Same for low tetrad.
- XOR: Bitwise XOR of key hash with permutation result.
Key for block 0: SHA-1 hash of key #1 (20 bytes) + key #2 (16 bytes) + block number zeros (4 bytes).
Decryption reverses: XOR first, then reverse permutation.
Commands
Section titled “Commands”0018 Send Encrypted Request
Section titled “0018 Send Encrypted Request”Same structure as EXT000E. Devices return error 0006 for non-wrapped commands except Handshake, KeepAlive, and encryption setup.
Request/Response:
<TID> 3900 <LEN> 0018 <PAYLOAD>PAYLOAD Format
Section titled “PAYLOAD Format”<WRAPLEN> <CMD> <DATA> <CHKSUM> <PADDING>| Field | Length | Description |
|---|---|---|
WRAPLEN | 2 bytes | Length of CMD + DATA |
CMD | 2 bytes | Command code |
DATA | variable | Data field |
CHKSUM | 2 bytes | Byte sum of CMD + DATA |
PADDING | multiple of 16 | Random bytes (min 128 total) |
Decryption error returned unencrypted: <TID> 3900 0004 8018 0010