quicwg / load-balancers

In-progress version of draft-ietf-quic-load-balancers

Home Page:https://quicwg.org/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Simplify Short Connection CID Algorithm

martinduke opened this issue · comments

There's a lot of needless bitshifting in the current algorithm. When reading from the right, each byte has to be shifted 4 bits and ORed with the neighboring byte, as currently written.

There's an easier way.
When encrypting side X (= { left, right }) and XORing with side Y.

Set Y to zero.
Set the index value (= 1..4) in the furthest byte that has been zeroed.
Encrypt to get ciphertext
XOR Y with the bits in the same position as Y.