A hash function deterministically converts data into a compact value. Changing the data normally changes the value, making hashes useful for detecting modified files and protecting stored passwords. section 18.4 section 29.4.4
Common applications include:
- Cache busting: ASP.NET Core can hash a referenced file and append the result as a query string. Unchanged files keep the same URL and browser cache; modified files receive a new URL. section 18.4
- Password protection: store cryptographic hashes rather than passwords directly, using an expensive algorithm such as BCrypt or PBKDF2. section 29.4.4
Versioning a script automatically
Add asp-append-version="true" to a script, image, or link element. The generated URL includes a content-based query string such as ?v=EWaMeWsJBYWmL2g_KkgXZQ5nPe; editing the file changes that value and prompts browsers to request the updated resource. section 18.4
<script src="~/js/site.js" asp-append-version="true"></script>
Shows the concise Tag Helper syntax for adding a content hash to a script URL. section 18.4















