Use custom toByteArray implementation to align with JS-prover