c.new(&#39;unique-key-here&#39;, pickle_data, hashlib.blake2b).hexdigest()

if not secrets.compare_digest(digest, expected_digest):
    print(&#39;Invalid signature&#39;)
    exit(1)

obj = pickle.loads(pickle_data)
</code></pre>
<h2>See Also</h2>
<ul>
  <li><a href="https://www.synopsys.com/blogs/software-security/python-pickling/">Understanding Python pickling and how to use it securely at synopsys.com</a></li>
</ul>