Hardware is metal, plastic, motors, coils, chips, etc. Software is code that you can read/write. PLC program, programs stored on hard drive, etc. Firmware is software that is stored on an EPROM, EEPROM, or some other device that you typically would not reprogram.
A dongle has a preprogrammed Microprocessor. It is set up in such a way as to make it impossible to 'crack'. Some on the older ones were easily copied by hackers, but the new ones have the software embedded to a point where it is impossible to access. The Microprocessor is hardware, the embedded code is firmware (software that you can't change).
A Dongle connects to the parallel port, USB port, etc. The program reads it to get a serial number that must match a code in your program. The software won't run unless the Dongle makes it happy.