While conversion between decimal and hex is typically simple, I'm trying to come up with a method that can't result in an arithmetic overflow.

Is there an algorithm for converting a string of (effectively) unlimited length representing a hexadecimal value to its decomal equivalent (and vice-versa)?