Difference between Shimano HG51 8-Speed Cassette and Shimano HG50 8-Speed Cassette
The only difference is the model number, and the year of the design. They are fully compatible, assuming the number of gears is the same, and that you buy the appropriate match to your bike. The road version is Tiagra 8 speed. The mountain/hybrid version is Alivio 8 speed.