hello fellow stripe capture the flag contestant :)
this is how you do it (make sure that there is a newline!)
require 'digest/sha1'
content = "tree #{tree}
parent #{parent}
author CTF user <me@example.com> #{timestamp} +0000
committer CTF user <me@example.com> #{timestamp} +0000
Give me a Gitcoin
1
"
Digest::SHA1.hexdigest "commit #{content.length}\0#{content}"