Simon Willison’s Weblog

Subscribe
Atom feed for sha1

4 items tagged “sha1”

2010

Don’t Hash Secrets. A well written explanation from 2008 of why you must use hmac instead of raw SHA-1 when hashing against a secret.

# 24th January 2010, 1:30 pm / cryptography, hmac, security, sha1, signing

Design and code review requested for Django string signing / signed cookies. Do you know your way around web app security and cryptography (in particular signing things using hmac and sha1)? We’d appreciate your help reviewing the usage of these concepts in Django’s proposed string signing and signed cookie implementations.

# 4th January 2010, 1:24 pm / codereview, cryptography, django, hashing, hmac, python, security, sha1

2008

Django snippets: Sign a string using SHA1, then shrink it using url-safe base65. I needed a way to create tamper-proof URLs and cookies by signing them, but didn’t want the overhead of a full 40 character SHA1 hash. After some experimentation, it turns out you can knock a 40 char hash down to 27 characters by encoding it using a custom base65 encoding which only uses URL-safe characters.

# 27th August 2008, 10:18 pm / base65, cookies, cryptography, django, django-snippets, hashes, python, security, sha1, signedcookies, urls

hash. Douglas Crockford: “Any HTML tag that accepts a src= or href= attribute should also be allowed to take a hash= attribute”—to protect against file tampering and (more importantly) provide a truly robust caching mechanism.

# 30th March 2008, 6:34 pm / caching, douglas-crockford, hash, html, sha1