# Numerazione e ordine dei bit

> Ogni bit di un valore con il suo peso e il suo numero nelle numerazioni LSB 0, MSB 0 e da 1, il campo che indichi come bit da i a j, il valore con i bit invertiti e nell’ordine in cui lo trasmette un link, una stringa di bit stampata letta nell’ordine in cui è stata stampata, e un indirizzo MAC in forma canonica e con i bit invertiti, con i bit I/G e U/L indicati per nome. Layout per lo stato LACP, i flag TCP, i flag DNS, l’ottetto ToS e il tag 802.1Q.

- Tool: https://ronutz.com/it/tools/bit-numbering-and-order
- Family: Reti

---

## Cosa fa

Ogni bit di un numero binario ha un peso, e i documenti non concordano su come chiamare ciascuno. Il bit meno significativo (LSB, least significant bit) è quello che vale 1, il bit più significativo (MSB, most significant bit) quello che vale di più, e le tre numerazioni in uso contano da estremità diverse o partono da un numero diverso. La pagina risponde alle domande che ne derivano, in tre modalità:

- **Valore.** Un numero e la sua larghezza: ogni bit con il suo peso e il suo numero nelle numerazioni LSB 0, MSB 0 e da 1, i bit impostati in ciascuna, il numero di uni e il bit di parità, i bit impostati più basso e più alto, la lettura in complemento a due, il valore con i bit invertiti, ottetto per ottetto e per intero, gli ottetti scambiati, e l’ordine che i bit assumono su un link che invia per primo il bit meno significativo e su uno che invia per primo il più significativo. Facoltativamente un layout noto indica il nome di ogni campo, e «bit da i a j» in qualsiasi numerazione dà maschera, scorrimento e valore del campo.
- **Bit stampati.** Una stringa di 0 e 1 così come l’ha stampata un dispositivo, con l’ordine in cui è stata stampata: il valore che rappresenta e il valore che la stessa stringa darebbe se letta nell’altro senso.
- **Indirizzo MAC.** Un indirizzo MAC (Media Access Control) a 48 bit scritto in forma canonica o con i bit invertiti: entrambe le forme, i bit I/G (individual/group, individuale o di gruppo) e U/L (universal/local, universale o locale), il quadrante di un indirizzo locale secondo lo Structured Local Address Plan (SLAP) e i 48 bit nell’ordine in cui li invia un link Ethernet.

Tutto viene calcolato nel tuo browser.

## Le tre numerazioni

- **LSB 0**: il bit 0 è il meno significativo, quindi il bit k vale 2 elevato alla k. Il manuale Intel lo riassume in una frase: le posizioni dei bit sono numerate da destra a sinistra e il valore di un bit impostato è due elevato alla posizione del bit («Bit positions are numbered from right to left. The numerical value of a set bit is equal to two raised to the power of the bit position», [Intel SDM volume 1](https://cdrdv2-public.intel.com/825744/253665-sdm-vol-1.pdf), 1.3.1). Il kernel Linux scrive le maschere allo stesso modo, `BIT(nr)` come `1 << nr` e `GENMASK(h, l)` come maschera di bit contigua che va dalla posizione @l alla posizione @h («a contiguous bitmask starting at bit position @l and ending at position @h», [include/linux/bits.h](https://raw.githubusercontent.com/torvalds/linux/master/include/linux/bits.h)).
- **MSB 0**: il bit 0 è il più significativo. La usano tutti i diagrammi delle RFC (Request for Comments): il bit con l’etichetta zero è il più significativo («the bit labeled 0 is the most significant bit»), quindi l’ottetto disegnato `1 0 1 0 1 0 1 0` vale 170 ([RFC 791](https://www.rfc-editor.org/rfc/rfc791.txt), appendice B). Anche la z/Architecture di IBM numera così i propri registri: nella modalità di indirizzamento a 24 bit, i bit iniziali del valore intermedio, da zero a trentanove, vengono ignorati («bits 0-39 of the intermediate value are ignored», [IBM SA22-7832-13](https://publibfi.dhe.ibm.com/epubs/pdf/a227832d.pdf)).
- **Da 1**: il bit 1 è il meno significativo. SNMP (Simple Network Management Protocol) colloca un valore BITS nei bit di ogni ottetto numerati da otto, il più alto, a uno, il più basso («bits 8 (high order bit) to 1 (low order bit)», [RFC 3417](https://www.rfc-editor.org/rfc/rfc3417.txt), sezione 8), e il comando `display eth-trunk` di Huawei documenta il PortState LACP da Bit 1 a Bit 8 ([Huawei, Link Aggregation Commands](https://support.huawei.com/enterprise/en/doc/EDOC1100514211/54c5f31b/link-aggregation-commands)).

Su una larghezza di w bit, il bit k in LSB 0 è il bit w - 1 - k in MSB 0 e il bit k + 1 nella numerazione da 1. La pagina mostra tutte e tre le numerazioni per ogni bit, così un numero letto in un documento si ritrova in un altro.

## Valore: i dati in ingresso

- **Valore**: esadecimale con `0x` (`0x3D`), binario con `0b` (`0b0011_1101`) o cifre decimali (`61`); singoli spazi o trattini bassi possono separare gruppi di cifre. Un segno meno davanti a un decimale ne dà i bit in complemento a due. Una stringa di cifre esadecimali senza `0x` viene rifiutata con un suggerimento, così `10` non vale mai in silenzio dieci o sedici.
- **Larghezza**: da 1 a 64 bit. Se la lasci vuota, deriva dall’input: quattro bit per ogni cifra esadecimale e uno per ogni cifra binaria, zeri iniziali compresi (quindi `0x0800` è di 16 bit), oppure il più piccolo tra 8, 16, 32 e 64 che contiene un valore decimale.
- **Layout** (facoltativo), per un valore della larghezza del layout:
  - **Stato LACP** (8 bit): l’ottetto Actor_State o Partner_State del protocollo LACP (Link Aggregation Control Protocol). Lo standard 802.1AX dell’IEEE (Institute of Electrical and Electronics Engineers) numera i bit da 0 (LACP_Activity) a 7 (Expired) ([IEEE8023-LAG-MIB](https://www.ieee802.org/1/files/public/MIBs/IEEE8021-AX-MIB-202005290000Z.mib)), le maschere del driver Linux vanno da `0x1` a `0x80` ([if_bonding.h](https://raw.githubusercontent.com/torvalds/linux/master/include/uapi/linux/if_bonding.h)) e Huawei stampa gli stessi bit da Bit 1 a Bit 8.
  - **Primo ottetto MAC** (8 bit): i bit I/G e U/L, definiti come «The least significant bit of Octet 0 (the I/G bit)» e «the second least significant bit of Octet 0 (the U/L bit)» ([IEEE RA guidelines](https://standards-support.ieee.org/hc/en-us/articles/4888705676564-Guidelines-for-Use-of-Extended-Unique-Identifier-EUI-Organizationally-Unique-Identifier-OUI-and-Company-ID-CID)), con i bit Y e Z che la [RFC 9542](https://www.rfc-editor.org/rfc/rfc9542.txt) disegna sopra di essi (sezione 2.1).
  - **Flag TCP** (8 bit): il quattordicesimo ottetto dell’intestazione, CWR, ECE, URG, ACK, PSH, RST, SYN, FIN ([RFC 9293](https://www.rfc-editor.org/rfc/rfc9293.txt), sezione 3.1). L’IANA (Internet Assigned Numbers Authority) li numera da 8 a 15 nel suo registro TCP Header Flags ([IANA](https://www.iana.org/assignments/tcp-parameters/tcp-parameters.xml)), Linux da `BIT(7)` a `BIT(0)` ([include/net/tcp.h](https://raw.githubusercontent.com/torvalds/linux/master/include/net/tcp.h)).
  - **Flag DNS** (16 bit): la seconda parola dell’intestazione DNS (Domain Name System), QR, Opcode, AA, TC, RD, RA, Z, AD, CD e RCODE come li disegnano la [RFC 1035](https://www.rfc-editor.org/rfc/rfc1035.txt) (sezione 4.1.1) e la [RFC 6895](https://www.rfc-editor.org/rfc/rfc6895.txt) (sezione 2); il registro DNS Header Flags dell’IANA numera i flag da AA, bit 5, a CD, bit 11 ([IANA](https://www.iana.org/assignments/dns-parameters/dns-parameters.xml)).
  - **ToS IPv4** (8 bit): l’ottetto Type of Service, il Traffic Class di IPv6: il DSCP (differentiated services codepoint) nei bit da 0 a 5 ([RFC 2474](https://www.rfc-editor.org/rfc/rfc2474.txt), sezione 3) e l’ECN (Explicit Congestion Notification) negli ultimi due bit («Bits 6 and 7», [RFC 3168](https://www.rfc-editor.org/rfc/rfc3168.txt), sezione 5), con il nome del codepoint ECN.
  - **TCI 802.1Q** (16 bit): priorità, DEI (Drop Eligible Indicator) e ID VLAN (Virtual Local Area Network, rete locale virtuale) del tag, con le maschere del kernel Linux `0xe000` (scorrimento 13), `0x1000` e `0x0fff` ([include/linux/if_vlan.h](https://raw.githubusercontent.com/torvalds/linux/master/include/linux/if_vlan.h)).
- **Bit da i a j** (facoltativo): una numerazione e uno o due numeri di bit. Maschera, scorrimento e valore del campo, l’espressione C `(v >> shift) & mask` e il `GENMASK(hi, lo)` del kernel (o `BIT(n)` per un solo bit), e gli stessi bit nelle altre due numerazioni.

## Valore: le regole

- **Complemento a due.** Il valore letto come numero con segno è negativo quando il suo bit più alto è impostato; per 8, 16, 32 e 64 bit vale la frase di Intel, che colloca il bit di segno nel bit più alto di ciascun formato intero («The sign bit is located in bit 7 in a byte integer, bit 15 in a word integer, bit 31 in a doubleword integer, and bit 63 in a quadword integer», Intel SDM, 4.2.1.2).
- **Bit impostato più basso e più alto.** Numerati in LSB 0, sono ciò che restituiscono le istruzioni BSF e BSR di Intel: lo scostamento dal bit meno significativo della stringa di bit al primo bit impostato («the offset from the least significant bit (bit 0) in the bit string to the first set bit», 7.3.7.2).
- **Parità.** La parità pari aggiunge il bit che rende pari il numero di uni logici nei bit di dati e di parità («an even number of logic 1s in the data and parity bits»), la parità dispari il bit che lo rende dispari ([TI TL16C550D](https://www.ti.com/lit/ds/symlink/tl16c550d.pdf), bit 4 del line control register).
- **Inversione.** «Tutti i bit invertiti» rispecchia l’intera larghezza; «Bit invertiti in ogni ottetto» rispecchia ogni ottetto sul posto, lo scambio che la [RFC 2469](https://www.rfc-editor.org/rfc/rfc2469.txt) descrive tra indirizzi canonici e indirizzi Token Ring; «Ottetti scambiati» è l’ordine dei byte, spiegato in [Big-endian and little-endian](https://ronutz.com/it/learn/big-endian-and-little-endian). Rispecchiare l’intera larghezza equivale alle altre due operazioni insieme. Il CRC-32 del kernel Linux, un controllo di ridondanza ciclica (CRC, cyclic redundancy check), mostra un’inversione: lo stesso polinomio è `0x04c11db7` con il bit più significativo per primo e `0xedb88320` con il bit meno significativo per primo ([include/linux/crc32.h](https://raw.githubusercontent.com/torvalds/linux/master/include/linux/crc32.h)).
- **Sul cavo.** Per ottetti interi, i bit nell’ordine in cui li invia un link, ottetto per ottetto, con gli ottetti nell’ordine in cui sono scritti (prima il più significativo, come l’ordine dei byte di rete invia un numero, RFC 791). Il bit meno significativo per primo è l’ordine di Ethernet, l’inverso di quello disegnato dall’IETF (Internet Engineering Task Force): l’ordine fisico di trasmissione dei bit all’interno di un ottetto su un link IEEE va dal bit più basso al più alto («the physical order of bit transmission within an octet on an IEEE [802.3] link is from the lowest order bit to the highest order bit (i.e., the reverse of the IETF's ordering)», RFC 9542, sezione 1.1); l’UART (Universal Asynchronous Receiver-Transmitter, ricevitore-trasmettitore asincrono universale) fa lo stesso, perché il bit meno significativo è il primo trasmesso o ricevuto in serie («Bit 0 is the least significant bit. It is the first bit serially transmitted or received», TI TL16C550D), e così il PPP (Point-to-Point Protocol), che trasmette ogni ottetto a partire dal bit meno significativo («All octets are transmitted least significant bit first», [RFC 1662](https://www.rfc-editor.org/rfc/rfc1662.txt), sezioni 4.5.2 e 5.5). Il bit più significativo per primo è la regola di un bus I2C, che trasferisce i dati a partire dall’MSB («Data is transferred with the Most Significant Bit (MSB) first», [NXP UM10204](https://www.nxp.com/docs/en/user-guide/UM10204.pdf), 3.1.5), e l’impostazione predefinita di un bus SPI (Serial Peripheral Interface), con l’MSB per primo in ogni parola di un trasferimento («the 'MSB first' default for each word in a transfer»), che un dispositivo può cambiare con `SPI_LSB_FIRST` ([include/linux/spi/spi.h](https://raw.githubusercontent.com/torvalds/linux/master/include/linux/spi/spi.h)).

## Bit stampati

Inserisci i bit nell’ordine in cui sono stampati e indica quale estremità viene per prima. **Prima il bit più significativo** è l’ordine in cui si scrivono i numeri. **Prima il bit meno significativo** è il modo in cui Huawei stampa un PortState LACP: la sua guida di riferimento dei comandi descrive la variabile di stato a otto bit dell’esempio («The status variable is eight bits, such as 10111100») da Bit 1 a Bit 8, nell’ordine dei bit da 0 a 7 dell’802.1AX, quindi il suo primo carattere è LACP_Activity, il bit di peso 1, e `10111100` è l’ottetto 0x3D (Huawei, tabella 5-17). Letta nell’altro senso, la stessa stringa varrebbe 0xBC, e la pagina mostra entrambi i valori, perché un ordine letto male cambia il numero senza alcun errore. Segue la lettura completa del valore, con il layout dello stato LACP se lo scegli.

## Indirizzo MAC

- **La forma canonica** è il modo in cui la [RFC 2469](https://www.rfc-editor.org/rfc/rfc2469.txt) definisce un indirizzo per la visualizzazione: il primo bit di ogni byte che compare sulla LAN corrisponde al bit meno significativo, cioè quello più a destra, di ogni byte in memoria («The first bit of each byte that appears on the LAN maps to the least significant (i.e., right-most) bit of each byte in memory»), il che colloca l’indicatore di indirizzo di gruppo nel bit meno significativo del primo byte («puts the group address indicator ... in the least significant bit of the first byte»). L’hardware Ethernet funziona così.
- **La forma con i bit invertiti** («MSB format», «non-canonical form») è il modo in cui Token Ring e alcuni adattatori FDDI (Fiber Distributed Data Interface) conservavano gli indirizzi: ogni ottetto con i bit invertiti, quindi 12-34-56-78-9A-BC stava in memoria come 48-2C-6A-1E-59-3D. Scegli la forma in cui è scritto l’indirizzo; la pagina dà l’altra.
- **I/G e U/L.** Dal primo ottetto canonico: I/G 0 per una sola stazione, 1 per un gruppo (multicast o broadcast); U/L 0 per un indirizzo sotto un prefisso assegnato dall’IEEE, 1 per un indirizzo locale (IEEE RA guidelines; RFC 9542). Il kernel Linux li verifica come `0x01 & addr[0]` e `0x02 & addr[0]` ([include/linux/etherdevice.h](https://raw.githubusercontent.com/torvalds/linux/master/include/linux/etherdevice.h)).
- **Quadrante SLAP.** Per un indirizzo locale, i bit Y e Z scelgono uno di quattro quadranti: Administratively Assigned (Y 0, Z 0), Extended Local (Y 0, Z 1), Reserved (Y 1, Z 0) e Standard Assigned (Y 1, Z 1) (RFC 9542, sezione 2.1.1, tabella 2); il piano è facoltativo.
- **Sul cavo.** I 48 bit ottetto per ottetto, ognuno a partire dal bit meno significativo, quindi il primo bit inviato è il bit I/G.
- **La riga della lettura errata** mostra che cosa concluderebbe su I/G e U/L chi scambiasse la forma con i bit invertiti per quella canonica. La RFC 2469 ne registra la conseguenza pratica: i bridge tra Token Ring ed Ethernet dovevano invertire i bit degli indirizzi nei campi indirizzo dei pacchetti ARP, quelli dell’Address Resolution Protocol («perform bit swaps of the addresses in the address fields of ARP packets», sezione 3.2).

## Cosa rifiuta, e perché

Un campo più lungo di 80 caratteri; un campo vuoto; un esadecimale senza `0x` (con un suggerimento), un prefisso non seguito dalle sue cifre, l’ottale, un indirizzo MAC nella modalità Valore (che rimanda alla modalità Indirizzo MAC); un valore di oltre 64 bit; una larghezza al di fuori dell’intervallo da 1 a 64 o un valore che non entra nella sua larghezza (con i bit necessari), e un decimale negativo fuori dall’intervallo in complemento a due della larghezza; un layout, una numerazione, un ordine di stampa o una forma MAC sconosciuti; un layout di larghezza diversa da quella del valore (con la larghezza da impostare); un numero di bit che non è intero o che non esiste nella larghezza per la numerazione scelta (con l’intervallo); un ultimo bit senza un primo; una stringa stampata con caratteri diversi da 0, 1 e separatori singoli; e un indirizzo MAC che non è formato da sei ottetti in una delle quattro forme.

## Esempi svolti

- **I flag di risposta DNS 0x81A0** (l’Esempio, tratto dall’articolo della sezione Imparare sull’intestazione DNS): letti come flag DNS, sono impostati QR, RD, RA e AD. QR è il bit 0 in MSB 0 e il bit 15 in LSB 0; RD, che l’IANA numera come bit 7, è il bit 8 in LSB 0.
- **Il PortState 10111100 di Huawei** (l’Esempio dei bit stampati), a partire dal bit meno significativo: 0x3D, con LACP_Activity, Aggregation, Synchronization, Collecting e Distributing impostati; letto per errore a partire dal bit più significativo, è 0xBC. Gli esempi 10100000 e 10110000 valgono 0x05 e 0x0D.
- **Lo «0111101 (binary)» di Cisco**: il documento di Cisco sulla risoluzione dei problemi degli EtherChannel indica il valore atteso dei flag LACP («The expected value for LACP flags is 0x3D (hex) or 0111101 (binary)», [Cisco, document 220367](https://www.cisco.com/c/en/us/support/docs/switches/catalyst-9300-series-switches/220367-troubleshoot-etherchannels-on-catalyst-9.html)). Inserite come `0b0111101`, quelle sette cifre sono un valore a 7 bit, e il layout LACP a 8 bit lo rifiuta; con la larghezza impostata a 8 torna lo zero iniziale omesso e il valore è 0x3D, lo stesso ottetto che Huawei stampa come 10111100.
- **L’indirizzo della RFC 2469** (l’Esempio della modalità MAC): 12-34-56-78-9A-BC è locale (U/L 1) e individuale, Administratively Assigned secondo lo SLAP, e con i bit invertiti diventa 48-2C-6A-1E-59-3D; letta come canonica, quella forma invertita sembrerebbe universale.
- **DSCP dal ToS 0xB8**: i bit da 0 a 5 in MSB 0 sono i bit da 7 a 2 in LSB 0, `GENMASK(7, 2)`, maschera 0xFC, scorrimento 2, valore 46.
- **Il polinomio CRC-32 0x04C11DB7** con i bit invertiti è 0xEDB88320, le due forme dello stesso polinomio nel kernel; la costante FCS-16 della RFC 1662, 0x8408, invertita è 0x1021.

## Cosa non fa

Legge i valori e gli indirizzi che inserisci; non cattura traffico e non comunica con alcun dispositivo. Non calcola checksum né CRC, non converte l’ordine dei byte oltre a mostrare gli ottetti scambiati, non decodifica intestazioni intere (lo fanno il [decodificatore di tag 802.1Q](https://ronutz.com/it/tools/vlan-tag-and-trunk-calculator), l’[analizzatore dei link membri e dello stato LACP](https://ronutz.com/it/tools/lacp-hash-and-state-reader) e gli strumenti DNS) e non indica il vendor di un indirizzo MAC (lo fa la [ricerca del vendor per OUI / MAC](https://ronutz.com/it/tools/oui-lookup)).

## Condivisione dei risultati

Sotto il titolo del risultato, **Condividi i risultati** crea un link a questa pagina, solo quando lo premi, che contiene dopo il `#` il campo così come l’hai inserito e le impostazioni proprie della modalità: sempre `input` e `mode` (`value`, `printed` o `mac`); nella modalità Valore `width` se inserita, `layout` se ne hai scelto uno, e `numbering`, `from` e `to` (se inseriti) per un campo; nella modalità Bit stampati `order`, `layout` e il campo come nella modalità Valore; nella modalità Indirizzo MAC `form`. Le impostazioni delle altre modalità non vengono incluse.

La [RFC 3986](https://www.rfc-editor.org/rfc/rfc3986.txt) (sezione 3.5, consultata l’08/11/2026) stabilisce che il frammento viene separato dal resto dell’URI prima della dereferenziazione («separated from the rest of the URI prior to a dereference»), quindi questi valori non vengono inviati al server quando si apre il link; restano nella barra degli indirizzi e nella cronologia di chi lo apre, e chiunque abbia il link può leggerli.

- **Lunghezza massima.** Un link contiene al massimo 16.384 caratteri, il limite che il sito applica a ogni valore dopo il `#`; questi campi sono molto più corti.
- **Apertura di un link.** La modalità e le sue impostazioni vengono impostate come se le inserissi tu, le altre modalità conservano i loro valori e la pagina esegue il calcolo. Un link con una modalità, un layout, un ordine, una forma o una numerazione sconosciuti, un’impostazione di un’altra modalità, una larghezza o un numero di bit che non è composto da una a tre cifre, un `to` senza `from`, una numerazione senza `from`, o un campo su più di una riga o più lungo di 80 caratteri viene ignorato. Accettati o no, i valori poi lasciano subito l’indirizzo della pagina, senza alcuna richiesta, quindi un ricaricamento, un segnalibro o il pulsante Condividi della pagina stessa non contengono nulla che tu non abbia scelto di condividere.

## Provenienza

Il motore è aritmetica fissa sui bit con valori BigInt, senza orologio, senza rete e senza casualità. I suoi vettori di test di riferimento (golden vectors, insieme `bit-numbering-and-order-golden-2026-11-08`) fissano tutti i 256 ottetti nella modalità Valore e stampati a partire dal bit meno significativo, le larghezze da 1 a 64 (tutti uni e il solo bit più alto), la deduzione della larghezza da esadecimale, binario e decimale, i decimali negativi, ogni layout su più valori, campi in tutte e tre le numerazioni, compreso l’esempio `GENMASK_ULL(39, 21)` del kernel stesso, stringhe stampate in entrambi gli ordini con separatori, indirizzi MAC in ogni forma e in ogni quadrante SLAP, gli esempi del pulsante Esempio e quelli preimpostati, le frasi che esprimono le regole, i testi dell’API e i rifiuti. Ogni valore atteso è stato calcolato da un modello Python separato scritto a partire dai documenti (bit come testo, posizioni come indici di stringa, inversione invertendo il testo, ottetti con `int.to_bytes`), non eseguendo questo motore.

## API

Lo stesso motore risponde a `/api/v1/bit-numbering-and-order` sull’API HTTP del sito; il contratto si trova nella [pagina dell’API](https://ronutz.com/it/api), che indica anche se questo sito offre l’API.

- **Richiesta.** Un oggetto JSON. Valore: `{"mode": "value", "input": "0x81A0", "width": 16, "layout": "dns-flags", "numbering": "msb0", "from": 1, "to": 4}`; `width`, `layout`, `numbering`, `from` e `to` sono facoltativi. Bit stampati: `{"mode": "printed", "input": "10111100", "order": "lsb-first", "layout": "lacp"}`; `order` (`msb-first` per impostazione predefinita) e il resto sono facoltativi. MAC: `{"mode": "mac", "input": "48-2C-6A-1E-59-3D", "form": "reversed"}`; `form` (`canonical` per impostazione predefinita) è facoltativo.
- **Risposta, Valore e Bit stampati.** `mode`, `width`, `widthInferred`, `hex`, `decimal`, `signed`, `binary`, `binaryLsbFirst`, `octets`, `bits` (ognuno con `lsb0`, `msb0`, `one`, `weight`, `set`), `setBits` (`lsb0`, `msb0`, `one`), `ones`, `parityEven`, `parityOdd`, `lowestSet`, `highestSet`, `reversed`, `reversedPerOctet`, `byteSwapped`, `wire` (`lsbFirst`, `msbFirst`), `printed` (`order`, `typed`, `otherHex`, `otherDecimal`, o null), `layout` (`id`, `width`, `fields`, `numberingNote`, o null), `field` (`numbering`, `from`, `to`, `lsb0Hi`, `lsb0Lo`, `msb0From`, `msb0To`, `oneHi`, `oneLo`, `span`, `mask`, `shift`, `value`, `valueHex`, `bits`, `expression`, `kernel`, o null) e `notes`.
- **Risposta, MAC.** `mode`, `form`, `formDefault`, `canonical`, `canonicalColon`, `reversed`, `firstOctetBits`, `group`, `local`, `broadcast`, `slap` (`y`, `z`, `quadrant`, `name`, o null), `wire`, `firstBitOnWire`, `reversedMisread` (`group`, `local`) e `notes`.
- **Errori.** HTTP 400, `invalid_input`, con il messaggio del motore, per esempio `"3D" looks hexadecimal: write it with 0x in front (0x3D), so it is not read as decimal.`.

## Fonti

- [Intel 64 and IA-32 Architectures Software Developer's Manual, volume 1, 253665-084US, giugno 2024](https://cdrdv2-public.intel.com/825744/253665-sdm-vol-1.pdf) (consultato l’08/11/2026): 1.3.1, 4.2.1.2, 7.3.7
- [IBM z/Architecture Principles of Operation, SA22-7832-13, maggio 2022](https://publibfi.dhe.ibm.com/epubs/pdf/a227832d.pdf) (consultato l’08/11/2026): capitolo 3
- [RFC 791, Internet Protocol](https://www.rfc-editor.org/rfc/rfc791.txt) (STD 5, consultata l’08/11/2026): appendice B
- [RFC 1035, Domain Names: Implementation and Specification](https://www.rfc-editor.org/rfc/rfc1035.txt) (STD 13, consultata l’08/11/2026): sezioni 2.3.2 e 4.1.1; [RFC 6895](https://www.rfc-editor.org/rfc/rfc6895.txt) (BCP 42, consultata l’08/11/2026): sezione 2; [IANA, DNS Header Flags](https://www.iana.org/assignments/dns-parameters/dns-parameters.xml) (aggiornato il 16/10/2026, consultato l’08/11/2026)
- [RFC 3417, Transport Mappings for SNMP](https://www.rfc-editor.org/rfc/rfc3417.txt) (STD 62, consultata l’08/11/2026): sezione 8
- [Huawei, S5700 and S6700 V200R025C00 Command Reference, Link Aggregation Commands](https://support.huawei.com/enterprise/en/doc/EDOC1100514211/54c5f31b/link-aggregation-commands) (consultato in un browser l’08/11/2026, perché il sito rifiuta le letture automatiche): display eth-trunk, tabella 5-17
- [Cisco, Troubleshoot EtherChannels on Catalyst 9000 Switches, document 220367](https://www.cisco.com/c/en/us/support/docs/switches/catalyst-9300-series-switches/220367-troubleshoot-etherchannels-on-catalyst-9.html) (aggiornato l’8 agosto 2024; consultato in un browser l’08/11/2026, perché il sito rifiuta le letture automatiche): i flag LACP attesi
- [IEEE8023-LAG-MIB for IEEE 802.1AX-2020](https://www.ieee802.org/1/files/public/MIBs/IEEE8021-AX-MIB-202005290000Z.mib) (consultato l’08/11/2026) e [include/uapi/linux/if_bonding.h](https://raw.githubusercontent.com/torvalds/linux/master/include/uapi/linux/if_bonding.h) del kernel Linux (consultato l’08/11/2026)
- [RFC 9542, IANA Considerations and IETF Protocol and Documentation Usage for IEEE 802 Parameters](https://www.rfc-editor.org/rfc/rfc9542.txt) (BCP 141, consultata l’08/11/2026): sezioni 1.1, 2.1, 2.1.1, 2.1.4 e 2.3.1
- [RFC 2469, A Caution On The Canonical Ordering Of Link-Layer Addresses](https://www.rfc-editor.org/rfc/rfc2469.txt) (Informational, consultata l’08/11/2026): sezioni 2 e 3
- [IEEE Registration Authority, Guidelines for Use of EUI, OUI and CID](https://standards-support.ieee.org/hc/en-us/articles/4888705676564-Guidelines-for-Use-of-Extended-Unique-Identifier-EUI-Organizationally-Unique-Identifier-OUI-and-Company-ID-CID) (aggiornato il 1º aprile 2022, consultato l’08/11/2026)
- [RFC 1662, PPP in HDLC-like Framing](https://www.rfc-editor.org/rfc/rfc1662.txt) (STD 51, consultata l’08/11/2026): sezioni 3.1, 4.5.2, 5.5 e appendice C.1
- [Texas Instruments, TL16C550D](https://www.ti.com/lit/ds/symlink/tl16c550d.pdf) (SLLS597E, consultato l’08/11/2026)
- [NXP Semiconductors, UM10204 I2C-bus specification and user manual, Rev. 7.0, 1 ottobre 2021](https://www.nxp.com/docs/en/user-guide/UM10204.pdf) (consultato in un browser l’08/11/2026, perché il sito rifiuta le letture automatiche): 3.1.5 Byte format, figura 10
- Il codice sorgente del kernel Linux, torvalds/linux master (consultato l’08/11/2026): [include/linux/spi/spi.h](https://raw.githubusercontent.com/torvalds/linux/master/include/linux/spi/spi.h), [include/linux/bits.h](https://raw.githubusercontent.com/torvalds/linux/master/include/linux/bits.h), [include/linux/crc32.h](https://raw.githubusercontent.com/torvalds/linux/master/include/linux/crc32.h), [include/linux/etherdevice.h](https://raw.githubusercontent.com/torvalds/linux/master/include/linux/etherdevice.h), [include/net/tcp.h](https://raw.githubusercontent.com/torvalds/linux/master/include/net/tcp.h) e [include/linux/if_vlan.h](https://raw.githubusercontent.com/torvalds/linux/master/include/linux/if_vlan.h)
- [IANA, TCP Header Flags](https://www.iana.org/assignments/tcp-parameters/tcp-parameters.xml) (aggiornato il 22/10/2026, consultato l’08/11/2026) e [RFC 9293, Transmission Control Protocol](https://www.rfc-editor.org/rfc/rfc9293.txt) (STD 7, consultata l’08/11/2026): sezione 3.1
- [RFC 2474, the DS Field](https://www.rfc-editor.org/rfc/rfc2474.txt) (consultata l’08/11/2026): sezione 3; [RFC 3168, ECN](https://www.rfc-editor.org/rfc/rfc3168.txt) (consultata l’08/11/2026): sezione 5
- [RFC 3986, Uniform Resource Identifier (URI): Generic Syntax](https://www.rfc-editor.org/rfc/rfc3986.txt) (STD 66, consultata l’08/11/2026): sezione 3.5
- [RFC Editor, RFC index](https://www.rfc-editor.org/rfc-index.xml) (consultato l’08/11/2026): lo stato di ogni RFC citata sopra

## Standards and references

- [Intel 64 and IA-32 Architectures Software Developer's Manual, volume 1, 253665-084US, June 2024: 1.3.1 Bit and Byte Order, 4.2.1.2 Signed Integers, 7.3.7 bit test and bit scan instructions](https://cdrdv2-public.intel.com/825744/253665-sdm-vol-1.pdf) - LSB 0: "Bit positions are numbered from right to left. The numerical value of a set bit is equal to two raised to the power of the bit position"; the sign bit in bit 7, 15, 31 or 63; BSF and BSR give "the offset from the least significant bit (bit 0)"
- [IBM z/Architecture Principles of Operation, SA22-7832-13, fourteenth edition, May 2022: chapter 3, information formats and operand addresses](https://publibfi.dhe.ibm.com/epubs/pdf/a227832d.pdf) - MSB 0 in a processor manual: "bits are numbered in a left-to-right sequence", an address's "bits are numbered 0-63", and in 24-bit mode "bits 0-39 of the intermediate value are ignored"
- [RFC 791, Internet Protocol, September 1981 (STD 5): Appendix B, Data Transmission Order](https://www.rfc-editor.org/rfc/rfc791.txt) - "the bit labeled 0 is the most significant bit"; the octet drawn 1 0 1 0 1 0 1 0 is 170; the most significant octet of a multi-octet quantity is transmitted first
- [RFC 1035, Domain Names: Implementation and Specification, November 1987 (STD 13): sections 2.3.2 and 4.1.1](https://www.rfc-editor.org/rfc/rfc1035.txt) - the same transmission-order rule; the header's flags word QR, Opcode, AA, TC, RD, RA, Z and RCODE as drawn
- [RFC 6895, Domain Name System (DNS) IANA Considerations, April 2013 (BCP 42): section 2](https://www.rfc-editor.org/rfc/rfc6895.txt) - the header drawing with AD and CD in the place of RFC 1035's Z bits
- [IANA, Domain Name System (DNS) Parameters, DNS Header Flags (registry updated 2026-10-16)](https://www.iana.org/assignments/dns-parameters/dns-parameters.xml) - AA bit 5, TC bit 6, RD bit 7, RA bit 8, bit 9 reserved, AD bit 10, CD bit 11 of the second 16-bit word (MSB 0)
- [RFC 3417, Transport Mappings for the Simple Network Management Protocol (SNMP), December 2002 (STD 62): section 8](https://www.rfc-editor.org/rfc/rfc3417.txt) - a BITS value is placed in "bits 8 (high order bit) to 1 (low order bit)" of each octet, first named bit first: 1-based numbering from the least significant bit
- [Huawei, S5700 and S6700 V200R025C00 Command Reference, Link Aggregation Commands: display eth-trunk and Table 5-17 PortState (read in a browser on 2026-11-08: the site refuses automated reads)](https://support.huawei.com/enterprise/en/doc/EDOC1100514211/54c5f31b/link-aggregation-commands) - "The status variable is eight bits, such as 10111100", described as Bit 1 to Bit 8 in the order of 802.1AX's bits 0 to 7; the example rows 10111100, 10100000 and 10110000
- [Cisco, Troubleshoot EtherChannels on Catalyst 9000 Switches, document 220367, updated 8 August 2024 (read in a browser on 2026-11-08: the site refuses automated reads)](https://www.cisco.com/c/en/us/support/docs/switches/catalyst-9300-series-switches/220367-troubleshoot-etherchannels-on-catalyst-9.html) - "The expected value for LACP flags is 0x3D (hex) or 0111101 (binary)", seven binary digits as printed (0x3D is 00111101 in 8 bits); its state table labels Expired the most significant bit and LACP Activity the least
- [IEEE 802.1 Working Group, IEEE8023-LAG-MIB (IEEE 802.1AX-2020), revision 2020-05-29: LacpState and dot3adAggPortActorAdminState](https://www.ieee802.org/1/files/public/MIBs/IEEE8021-AX-MIB-202005290000Z.mib) - LacpState BITS lacpActivity(0) to expired(7); "The first bit corresponds to bit 0 of the Actor_State (LACP_Activity)"
- [The Linux kernel source, include/uapi/linux/if_bonding.h (torvalds/linux master): LACP_STATE_* masks](https://raw.githubusercontent.com/torvalds/linux/master/include/uapi/linux/if_bonding.h) - LACP_STATE_LACP_ACTIVITY 0x1 to LACP_STATE_EXPIRED 0x80: 802.1AX's bit k is the bit of weight 2^k
- [RFC 9542, IANA Considerations and IETF Protocol and Documentation Usage for IEEE 802 Parameters, April 2024 (BCP 141): sections 1.1, 2.1, 2.1.1, 2.1.4 and 2.3.1](https://www.rfc-editor.org/rfc/rfc9542.txt) - bit transmission within an octet on an IEEE 802.3 link "from the lowest order bit to the highest order bit (i.e., the reverse of the IETF's ordering)"; the M, X, Y and Z bits of the first octet; the four SLAP quadrants; the documentation and 33-33 addresses of the samples
- [RFC 2469, A Caution On The Canonical Ordering Of Link-Layer Addresses, December 1998 (Informational): sections 2 and 3](https://www.rfc-editor.org/rfc/rfc2469.txt) - canonical form ("LSB format") against Token Ring's "MSB format"; 12-34-56-78-9A-BC held as 48-2C-6A-1E-59-3D; bridges that "perform bit swaps of the addresses" in ARP packets
- [IEEE Registration Authority, Guidelines for Use of Extended Unique Identifier (EUI), Organizationally Unique Identifier (OUI), and Company ID (CID), updated 1 April 2022](https://standards-support.ieee.org/hc/en-us/articles/4888705676564-Guidelines-for-Use-of-Extended-Unique-Identifier-EUI-Organizationally-Unique-Identifier-OUI-and-Company-ID-CID) - "The least significant bit of Octet 0 (the I/G bit)" and "the second least significant bit of Octet 0 (the U/L bit)"; EUI bit ordering, which "applications and protocols must unambiguously specify"
- [The Linux kernel source, include/linux/etherdevice.h (torvalds/linux master): is_multicast_ether_addr and is_local_ether_addr](https://raw.githubusercontent.com/torvalds/linux/master/include/linux/etherdevice.h) - the group test 0x01 & addr[0] and the local test 0x02 & addr[0] on the canonical address in memory
- [RFC 1662, PPP in HDLC-like Framing, July 1994 (STD 51): sections 3.1, 4.5.2, 5.5 and appendix C.1](https://www.rfc-editor.org/rfc/rfc1662.txt) - "All octets are transmitted least significant bit first"; binary numbers written most significant bit first, "contrary to standard ISO and CCITT practice which orders bits as transmitted"; the FCS-16 polynomial constant 0x8408
- [Texas Instruments, TL16C550D Asynchronous Communications Element with Autoflow Control, SLLS597E, revised December 2008](https://www.ti.com/lit/ds/symlink/tl16c550d.pdf) - "Bit 0 is the least significant bit. It is the first bit serially transmitted or received"; even parity is "an even number of logic 1s in the data and parity bits"
- [NXP Semiconductors, UM10204 I2C-bus specification and user manual, Rev. 7.0, 1 October 2021: 3.1.5 Byte format and Figure 10 (read in a browser on 2026-11-08: the site refuses automated reads)](https://www.nxp.com/docs/en/user-guide/UM10204.pdf) - "Data is transferred with the Most Significant Bit (MSB) first"; the first byte after START carries the target address from its most significant bit with the R/W bit as its least significant
- [The Linux kernel source, include/linux/spi/spi.h and include/uapi/linux/spi/spi.h (torvalds/linux master): spi_device mode, SPI_LSB_FIRST](https://raw.githubusercontent.com/torvalds/linux/master/include/linux/spi/spi.h) - the "MSB first" default for each word in a transfer, overridden by SPI_LSB_FIRST ("per-word bits-on-wire")
- [The Linux kernel source, include/vdso/bits.h and include/linux/bits.h (torvalds/linux master): BIT and GENMASK](https://raw.githubusercontent.com/torvalds/linux/master/include/linux/bits.h) - BIT(nr) is (1 << nr); GENMASK(h, l) is "a contiguous bitmask starting at bit position @l and ending at position @h", and GENMASK_ULL(39, 21) is 0x000000ffffe00000
- [The Linux kernel source, include/linux/crc32.h (torvalds/linux master): crc32_le and crc32_be](https://raw.githubusercontent.com/torvalds/linux/master/include/linux/crc32.h) - the same CRC-32 polynomial least-significant-bit-first as 0xedb88320 and most-significant-bit-first as 0x04c11db7: one is the other bit-reversed
- [IANA, Transmission Control Protocol (TCP) Parameters, TCP Header Flags (registry updated 2026-10-22)](https://www.iana.org/assignments/tcp-parameters/tcp-parameters.xml) - AE bit 7, CWR bit 8, ECE 9, URG 10, ACK 11, PSH 12, RST 13, SYN 14, FIN 15
- [The Linux kernel source, include/net/tcp.h (torvalds/linux master): TCPHDR_* flags](https://raw.githubusercontent.com/torvalds/linux/master/include/net/tcp.h) - TCPHDR_FIN BIT(0) to TCPHDR_CWR BIT(7), TCPHDR_AE BIT(8)
- [RFC 9293, Transmission Control Protocol (TCP), August 2022 (STD 7): section 3.1, header format](https://www.rfc-editor.org/rfc/rfc9293.txt) - the control bits CWR, ECE, URG, ACK, PSH, RST, SYN and FIN in that order after the Data Offset and the reserved bits
- [RFC 2474, Definition of the Differentiated Services Field (DS Field) in the IPv4 and IPv6 Headers, December 1998 (Proposed Standard, updated by RFC 3168, 3260 and 8436): section 3](https://www.rfc-editor.org/rfc/rfc2474.txt) - the DSCP in bits 0 to 5 of the DS field, "the left-most bit signifies bit 0"
- [RFC 3168, The Addition of Explicit Congestion Notification (ECN) to IP, September 2001 (Proposed Standard): section 5](https://www.rfc-editor.org/rfc/rfc3168.txt) - "Bits 6 and 7 in the IPv4 TOS octet are designated as the ECN field"; the codepoints Not-ECT, ECT(1), ECT(0) and CE
- [The Linux kernel source, include/linux/if_vlan.h (torvalds/linux master): VLAN_PRIO_MASK, VLAN_CFI_MASK and VLAN_VID_MASK](https://raw.githubusercontent.com/torvalds/linux/master/include/linux/if_vlan.h) - 0xe000 with shift 13 for the priority, 0x1000 "Canonical Format Indicator / Drop Eligible Indicator", 0x0fff for the VLAN ID
- [RFC 3986, Uniform Resource Identifier (URI): Generic Syntax, January 2005 (STD 66): section 3.5](https://www.rfc-editor.org/rfc/rfc3986.txt) - the fragment is "separated from the rest of the URI prior to a dereference": a Share results link's values are not sent to the server
- [RFC Editor, RFC index (XML): the current status of every RFC cited](https://www.rfc-editor.org/rfc-index.xml) - RFC 791, 1035, 1662, 3417, 9293 and 3986 are Internet Standards; RFC 9542 and 6895 are BCPs; RFC 2474 and 3168 Proposed Standards; RFC 2469 Informational; none obsoleted

## Related reading

- [Badges and cards: RFID, NFC, the Proxmark and MIFARE](https://ronutz.com/en/learn/badges-and-cards-rfid-nfc-the-proxmark-and-mifare.md): An office badge, a transit card and a car key's transponder are radio devices with no battery that answer whatever reader powers them. The cheap ones at 125 kHz answer with a bare number anyone can copy; the 13.56 MHz MIFARE Classic, the most deployed card of its kind, hid a weak cipher until researchers in Berlin and Nijmegen took it apart in 2007 and 2008, and its manufacturer lost a court bid to stop the publication. After reading, you can explain how passive cards are powered and which standards govern them, decode a 26-bit badge number, follow the Proxmark from Jonathan Westhues's bench to the Proxmark 5, read a MIFARE Classic authentication trace, date every major break from the car-key transponders of 2005 to the 2024 backdoor in compatible chips, see where Brazil's Bilhete Único and Brazilian law fit, and name the migrations and reader settings that actually defend a door.
- [Big-endian and little-endian: byte order explained](https://ronutz.com/en/learn/big-endian-and-little-endian.md): A number wider than one byte has to be laid out over several addresses, and machines disagree about which end goes first. What big-endian and little-endian mean, one 32-bit value byte by byte in both orders, where Danny Cohen found the names in 1980, why byte order is not bit order, network byte order in the RFCs and in POSIX, which processors are little-endian, big-endian or both, the instructions that swap bytes, the file formats and protocols that fix an order, what each order really costs, the bugs it causes, how to tell what a machine is, and three cases on this site: the LACP hash, the BIG-IP cookie and UTF-16.
- [Hiding in images: LSB, JPEG and adaptive steganography](https://ronutz.com/en/learn/hiding-in-images-lsb-jpeg-and-adaptive-steganography.md): Digital images became the favourite carrier for hidden messages because every pixel and every compressed coefficient is a number with a little noise in it. This part follows the techniques from the first least-significant-bit tools of the 1990s through palette tricks, JPEG coefficient embedding (JSteg, OutGuess, F5 and matrix embedding) to the content-adaptive schemes of the 2010s (HUGO, WOW, UNIWARD) and the syndrome-trellis codes that drive them. After reading, you can embed one byte into eight pixels by hand, explain why JPEG hiding works on quantized DCT coefficients, compute how matrix embedding saves changes, read a payload in bits per pixel critically, and name the open tools from their own documentation.
- [Least and most significant bit: bit numbering and bit order](https://ronutz.com/en/learn/least-and-most-significant-bit.md): Every bit of a binary number has a weight, and the least significant bit is worth 1 while the most significant bit is worth the most and, in two's complement, carries the sign. What significance means, why LSB and MSB sometimes mean bytes, the three ways documents number bits (LSB 0, MSB 0 and 1-based) and the same field read all three ways, the order bits travel on Ethernet, a UART, PPP, I2C and SPI, canonical and bit-reversed MAC addresses, masks, shifts, parity and reflected CRCs, the bugs a wrong order causes, and three cases on this site: Huawei's PortState printed bit 1 first, the I/G and U/L bits of a MAC address, and the DNS header flags.
- [Link aggregation and LACP: several links that act as one, and the protocol that keeps them honest](https://ronutz.com/en/learn/link-aggregation-and-lacp.md): A link aggregation group bundles parallel Ethernet links into one logical link for more bandwidth and for resilience. Where the standard came from (802.3ad, then 802.1AX), how LACP lets both ends agree before a single frame is sent, the fast and slow timers, why static bundles are risky, why one flow never goes faster than one member link, the rules members must follow, multi-chassis bundles, and the Linux bonding modes.
- [The DNS Header: Opcode, Status, and Flags](https://ronutz.com/en/learn/dns-message-header-and-flags.md): Every DNS message opens with the same 12-byte header: a 16-bit ID, a flags word that holds the opcode, seven named flags, a reserved bit and the response code, and four section counts, which dig prints as its header and flags lines. After reading, you can decode a header from its hexadecimal bytes, say what each flag, opcode and status tells a diagnosis, recognize a truncated answer and test the TCP retry it needs, and explain why the ID and the source port must be unpredictable.
- [The Ethernet frame, field by field: preamble to FCS, the 802.1Q tag, and the sizes that matter](https://ronutz.com/en/learn/the-ethernet-frame-field-by-field.md): Every Ethernet frame is the same short sequence of fields: a preamble to wake the receiver, two addresses, one field that is either a length or a type, the payload, and a checksum. What each field holds, why the minimum is 64 octets and the maximum 1518, where the 802.1Q tag goes and what it carries, and why jumbo frames are not in the standard.
- [The hardware hacker's bench: Bus Pirate, JTAG, UART and ChipWhisperer](https://ronutz.com/en/learn/the-hardware-hackers-bench-bus-pirate-jtag-uart-and-chipwhisperer.md): Every circuit board is built with doors for its makers: a serial console that prints the boot log, a Joint Test Action Group (JTAG) port defined by IEEE 1149.1 for testing and debugging, Arm's two-wire Serial Wire Debug, and the SPI and I2C buses where firmware and secrets are stored. This part explains what each interface is for and how it works, the tools that speak to them (the Bus Pirate, the JTAGulator, Saleae and sigrok logic analysers, Great Scott Gadgets' GreatFET, the Tigard, the Shikra and NewAE's ChipWhisperer), what power analysis and fault injection are, and how manufacturers lock the doors. After reading, you can read a UART settings line and a debug-header pin-out, decode a JTAG IDCODE down to the manufacturer, explain side-channel and glitch attacks in principle, retell four documented cases from their sources, and say which controls (readout protection, debug lockout, secure boot, tamper response) a product-security team should test.
- [What Is an OUI, and How MAC Addresses Are Assigned](https://ronutz.com/en/learn/what-is-an-oui.md): How a MAC address is structured, what the OUI (the manufacturer prefix) is and who hands it out, the difference between universally and locally administered addresses, and why a randomized Wi-Fi MAC has no vendor at all.
