update ht_md5 to use Puppet::Parser::Functions::newfunction

On ruby 1.9.3, using the old newfunction the method encode defined
inside the block is not visible
update to work on 1.9.3

string[x] returns a string instead of a fixnum on 1.9.3