JS code to convert between hex and bin IDs.