Baby step - Giant step discrete logarithm algorithm implementation in Java