Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
The moose likes Java in General and the fly likes Rabin Miller begining Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of REST with Spring (video course) this week in the Spring forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "Rabin Miller begining" Watch "Rabin Miller begining" New topic

Rabin Miller begining

tanshu sharma

Joined: Mar 09, 2013
Posts: 4
this is my rough code for Rabin Miller....(without next probable and witness)
i wrote this code..with help of William Stallings..for network security..and cryptography

i wanaa to write it..myself..

guyz..i have tested many times the code..but it didnt give Prime Number
is there any problem with the code.....then please..point's very very important for me.....or suggest me to generate prime no. using other ways..


Campbell Ritchie

Joined: Oct 13, 2005
Posts: 45307
Welcome to the Ranch
You didn’t use the code button correctly, but I have sorted that out. I also got rid of lots of unnecessary tags and excess whitespace, which makes the code more difficult to read.
Wny have you got comments like // BigInt for n, rather than simply calling the variable n? You also have too many imports. Isn’t there a BigInteger.ONE object ready for you to use?
You cannot work out the algorithm by reading the code. You need to write the algorithm on paper, and then carefully translate that to code. Have you done that? That is probably the only way you can sort out the problem.
It is sorta covered in the JavaRanch Style Guide.
subject: Rabin Miller begining
It's not a secret anymore!