How to hash data from 'getblocktemplate' request
The wiki has an extremely good explanation, with a python run-through that takes you from GBT output to share submission. You could also have a look at some of the implementation in Luke-Jr's "gmp-proxy", which translates GBT reponses into a getwork compatible interface.

https://en.bitcoin.it/wiki/Getblocktemplate

https://gitlab.com/bitcoin/eloipool/blob/master/gmp-proxy.py