Has anyone tried to protect media assets(with hash) outside Sitecore application? For example, if a request comes for a Sitecore media URL, you need to create a separate application(say a webApi), reference Sitecore kernel and use the same hashing algo that "ProtectMediaUrl" uses...and return the valid hash for the requested media ?
You are asking how to get the hash value for a Sitecore media item and specific parameters from a non-Sitecore application, yes? You only need the hash if you are providing querystring parameters to the media asset; note the
w parameters in this link:
You should be able to create an API as you mentioned that takes in the media reference and parameters you need, then returns the hash for the media item. However, this API would open your site up to the very type of attack that Media Request Protection is designed to prevent. If you go this route, make sure that API is properly secured and protected from malicious users.
If you don't need to use any parameters, you don't need to get the hash; Sitecore will return the unaltered media item.