/******************************************************************************/
//			Mandar Deodhar. Roll no : 03329014.
//		Network Security - Assignment 2 -  Question 1
//			Diffie-Hellman Crack
//	Public Key = 12375, Generator = 106, Prime number = 24691
/******************************************************************************/

class DF_Crack {
	public static void main(String args[]){
		long Y = 12375;
		long P = 24691;
		long g = 106;
		int X;
		long temp=1,temp1;
		
		for(X=1; X <= P; X++) {
			temp = g*temp;		//Finding power 
			temp = temp % P;	// Finding mod
			if(temp==Y)break;	// Compare
		}
		System.out.println("Cracked...");
		System.out.println("Private key is : "+X);
	}
}

/******************************************************************************/
//	Answer obtained is : 22392
//
/******************************************************************************/