slower but portable string_to_key