I decided to use the stdlib (hashlib) instead of libsecp for this, as it is simple enough, and the former is faster on my PC. Added a unit test that compares the two.
and require "schnorrsig" and "extrakeys" modules of libsecp256k1