Helper method for device identifier generation