Scan codes are what is sent by the keyboard. I've seen references in OSX documentation about virtual key codes being an intermediate representation for a key event.
> In macOS, the hardware scan codes generated by keyboards are mapped
to a set of virtual key codes that are hardware-independent. Pressing a
given key always generates the same virtual key code on any supported
keyboard.
> As keys are pressed, the system uses the virtual key
codes to create low-level keyboard events. For information on how to
simulate a keyboard event, see the function init(keyboardEventSource:virtualKey:keyDown:).
> The property’s value is hardware-independent.
I'm not sure if the Events.h below supports this notion or not. The 3 keyboard types, ANSI, ISO, and JIS, are likely to be sending scan codes based on some standard (or maybe not!).
/*
* Summary:
* Virtual keycodes
*
* Discussion:
* These constants are the virtual keycodes defined originally in
* Inside Mac Volume V, pg. V-191. They identify physical keys on a
* keyboard. Those constants with "ANSI" in the name are labeled
* according to the key position on an ANSI-standard US keyboard.
* For example, kVK_ANSI_A indicates the virtual keycode for the key
* with the letter 'A' in the US keyboard layout. Other keyboard
* layouts may have the 'A' key label on a different physical key;
* in this case, pressing 'A' will generate a different virtual
* keycode.
*/