github.com/rabbouni145/gg@v0.47.1/docs/content/en/hugo-pipes/fingerprint.md (about)

     1  ---
     2  title: Fingerprinting and SRI
     3  description: Hugo Pipes allows Fingerprinting and Subresource Integrity.
     4  date: 2018-07-14
     5  publishdate: 2018-07-14
     6  lastmod: 2018-07-14
     7  categories: [asset management]
     8  keywords: []
     9  menu:
    10    docs:
    11      parent: "pipes"
    12      weight: 70
    13  weight: 70
    14  sections_weight: 70
    15  draft: false
    16  ---
    17  
    18  
    19  Fingerprinting and [SRI](https://developer.mozilla.org/en-US/docs/Web/Security/Subresource_Integrity) can be applied to any asset file using `resources.Fingerpint` which takes two arguments, the resource object and a [hash function](https://en.wikipedia.org/wiki/Cryptographic_hash_function). 
    20  
    21  The default hash function is `sha256`. Other available functions are `sha512` and `md5`.
    22  
    23  Any so processed asset will bear a `.Data.Integrity` property containing an integrity string, which is made up of the name of the hash function, one hyphen and the base64-encoded hash sum.
    24  
    25  ```go-html-template
    26  {{ $js := resources.Get "js/global.js" }}
    27  {{ $secureJS := $js | resources.Fingerprint "sha512" }}
    28  <script type="text/javascript" src="{{ $secureJS.Permalink }}" integrity="{{ $secureJS.Data.Integrity }}"></script>
    29  ```