Negotiate a secure connection without certificates? I would like to have a simple  experience for a user for setting up a secure connection between two computers against a MITM attack. Something like the following:


  A number (possibly base64) appears on both screens, the user verifies
  that the number is identical and clicks OK.


Is there a standard algorithm for this?

If not - would the following be secure?


Each computer sends the other its public signing key. And then on each computer:
The keys are concatenated.
Then hashed with PBKDF2 (or the like).
The user is then shown that hash on both computers, and clicks OK on
both if they match.


Since an attacker can create signing keys quickly (since the attacker doesn't care that they be prime-based) trying for keys that will create the same hash as the one shown, the hash shown to the user would need to be relatively long (~100 bits?).
If you have a side channel where you can verify a string is identical you can simply do a Diffi Hellman key exchange and then verify both sides have the same resulting key.
If the side channnel is secure from evesdroppers you can directly compare the key. But you would probably prefer to compare a hash of the key. This also allows comparing something much shorter then the actual key.
For example I have seen systems for voice communication which after setting up the key the parties are expected to read out a verification number, but this simply assumes the mitm can not take the place of both parties and read out a different number to each. With nothing pre shared preventing man in the middle is tricky.
If you have a mitm resistant side channel which is public and very low bandwidth the above solution works. If it is high ebough bandwidth simply do DH key exchange over it.

Edit: to ensure the user can compare a short hash we should add a large random nounce before hashing the key. So a mitm won't be able to make keys which will collide with a truncated hash.