#NEWLINE# def edwards( P , Q ) : #NEWLINE# #INDENT# x1 = P [ 0 ] #NEWLINE# y1 = P [ 1 ] #NEWLINE# x2 = Q [ 0 ] #NEWLINE# y2 = Q [ 1 ] #NEWLINE# x3 = ( ( ( x1 * y2 ) + ( x2 * y1 ) ) * inv ( ( 1 + ( ( ( ( d * x1 ) * x2 ) * y1 ) * y2 ) ) ) ) #NEWLINE# y3 = ( ( ( y1 * y2 ) + ( x1 * x2 ) ) * inv ( ( 1 - ( ( ( ( d * x1 ) * x2 ) * y1 ) * y2 ) ) ) ) #NEWLINE# return [ ( x3 % q ) , ( y3 % q ) ]