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

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 https://www.elastic.co/guide/en/shield/current/index.html