Extraction of diff hash from GITHub commit url

Viewed 398
4 Answers

At the moment it is SHA256 of filename with path.

echo -n "path/file" | sha256sum

I have by coincidence asked support, and github aswered me that this is non documented. We should instead use some sort of API to recover the URI.

I don't like the answer but it is what it is.

The 32 characters following "diff-" is an MD5 hash of the path and filename. Here's an example using node.js:

const crypto = require('crypto');
var hash = crypto.createHash('md5').update(path+'/'+filename).digest('hex');
Related