Need help with the proof {needed for my algorithm}
Only an idea: if $$a+b=c+d$$ we get by squaring $$a^2+b^2=c^2+d^2$$ since $$ab=cd$$ so we get $$a^2-c^2=d^2-b^2$$ or $$a^2-d^2=b^2-c^2$$
Let $a+b=n=c+d$. Then $$ab=cd\implies a(n-a)=c(n-c)$$ so that $$an-a^2=cn-c^2,$$ or$$(a-c)n=a^2-c^2=(a-c)(a+c)$$
Either $a-c,$ and we are done, or $a-c\ne 0$ so we can cancel the $a-c$ to get $$n=a+c$$
Together with $n=aa+b$ this gives $b=c.$
In short, your assumption is correct.