@xero Shouldn't it be g^a mod p first?