For educational purpose, I would like to manually create a Git Blob without Git.
I've read that Git uses zlib and sha256, so I wrote this:
>>> import hashlib
>>> import zlib
>>> open('hello.txt', 'w').write('Hello World!\n')
>>> hashlib.sha256(zlib.compress(open('hello.txt', 'r').read().encode())).hexdigest()
'df46eac3bcbac69a75fbc5f87fe82c5f12c4991a9610805fc3fade2bb33fbb25'
However I don't get the same as Git:
$ git cat-file -p d712
100644 blob 980a0d5f19a64b4b30a87d4206aade58726b60e3 hello.txt
What am I missing?