This does not need a hashmap and can be done with a list ordered by greater-valued "digits" first. Also, it’d be nice to separate the roman-specific data from the generic "additive system" algorithm described in the spec. Then the same algorithm can be used for other counter styles.

http://dev.w3.org/csswg/css-counter-styles/#additive-system
http://dev.w3.org/csswg/css-counter-styles/#predefined-counters