animate.csssubresource-integrity

Subresource integrity for animate.css?


Google didn't turn up anything on the topic and there are some questions related to Subresource integrity on Stackoverflow but my question is: how do you generate this cryptographic hash for a CDN <link> ? In my case it is the animate.css, but I guess this can be applied to any custom CSS file.

Cheers


Solution

  • You can use SRIHash from Mozilla

    Example using animate.css from JSDelivr

    <link rel="stylesheet" 
          href="https://cdn.jsdelivr.net/animatecss/3.5.2/animate.min.css" 
          integrity="sha384-OHBBOqpYHNsIqQy8hL1U+8OXf9hH6QRxi0+EODezv82DfnZoV7qoHAZDwMwEJvSw" 
          crossorigin="anonymous">
    

    Or you can generate it using your console :

    https://developer.mozilla.org/en-US/docs/Web/Security/Subresource_Integrity#Tools_for_generating_SRI_hashes