How to calculate the shard id/name for given routing string?

I want to get the value of the shard ID/Name for a given routing string.
Say I got two shards data-1 and data-2 and routing string route1.

How can I simply calculate which shard ID/Name will be the result if the ES 2 routing algorithm?

Can you explain why exactly you need this information?

Not sure if you've seen it, maybe helps with your question.

Thank you for responding.
I need to determine to which shard is the document routed and which node carries this shard. This is required by my data flow security. Thus I need to have full information form document routing and shared allocation filtering.

The documentation I linked above has the formula for computing the id of the targeted shard. However when talking about security you might want to check out