add generate_prime for BN