I always thought it was us controllers, who told the pilots what to squawk, plus we didn’t use IFF. We used SIF. The only ones who used IFF, were the old world War 2 C-47s that came in. We hated it, since it didn’t work well at all.
What they squawked was what they dialed in for an ID
in mode 3 to let know who they are.
Mode 4 IFF is automatic and not under their control.
IFF stands for Identification Friend or Foe.
I guess they are up to mode 5 now.
better encryption.
SIF is for civilians.
In maintaining ATC radar circa 1970, I seem to recall our ground radar capable of both IFF/SIF but yeah, I never programed any codes for it. That was a long time ago though LOL.