I have flashed stock multiple times, but I didn't use Odin since the same stock firmware is available through Kies and it flashes it pretty much the same way and flawlessly.
I used Odin for other files but since the bootloaders are locked and encrypted I received an error message in red font in the download mode screen, and then Odin was disconnected. Knox counter did not advance in my case, but I did consider the possibility before flashing.
Kies, on the other hand, asks for the phone model and the serial number and then it lets you flash it. I'm assuming it might be generating md5 encryptions based on the phone model and serial number and then phone checks to match those before flashing. (Not sure!)
Sent from my SAMSUNG-SM-G900A using XDA Free mobile app