mercredi 17 février 2021

Generate a random number r', where r is an element of Zn

I had previously asked a question of how to generate a number, which was an element of Zn. This was answered and the solution as shown below:

How to Generate a Random Number, Which is an Element of Zn (Partially Blind Signature Program)

    public BigInteger getRandomModN(BigInteger n) {
        SecureRandom rnd = new SecureRandom();
        BigInteger randomModN;
        do {
            randomModN = new BigInteger(n.bitLength(), rnd);
        } while (randomModN.compareTo(n) >= 0);
        return randomModN;
    }

This is used to generate r ∈ Zn.

n is the result of p.q, where p and q are two large primes.

How would one then generate random number r'? Can this be done using the same method, or does it require further computation?




Aucun commentaire:

Enregistrer un commentaire