How to create a random 160 bit prime number in C++? -



How to create a random 160 bit prime number in C++? -

i working on project in school , need create 160 bit value. haven't programmed in while can't figure out how implement this. help appreciated.

you need library big integers (assuming can't take ready-to-use cryptographic library).

first create random 160-bit value, not prime. depending on platform, may utilize /dev/random, cryptgenrandom, or other enthropy source(s), (possible several ones, combined).

then increment value in loop, applying e.g. miller-rabin (pseudo-)primality test each candidate, until find prime number.

c++

Comments

Popular posts from this blog

javascript - mongodb won't find my schema method in nested container -

r - url in CRAN extension manual -

asp.net - .NET Control.ID property inconsistency -