A sha256 func pull request is welcomed – but note that without any caching, adding that script definition to a partial that is included in every template will be veeeery heavy in the performance department.
Interesting. I think a better approach is to write a tool that creates an integrity-manifest.json and puts it into the /data/ directory so that Hugo can access it that way. It prevents you’re needing to recalculate for every page, as BEP noted is a drawback of having it in the template.