This code comes from StarkWare crypto-cpp library: https://github.com/starkware-libs/crypto-cpp/blob/master/src/starkware/crypto/pedersen_hash.h