On the login question
There are many ways passwords can be used. The most direct (but less secure) is where the password itself is sent, in the clear, to the server. Other approaches still require the password to be sent but it is encrypted, for example with the server's public key. Other approaches involve an authentication challenge, whereby the server sends a random value/string which the client converts thorugh a hash function of sorts (involving the password as a key, of course), the result of the conversion is sent to the server which compares it with its own computation of the same process. The advantage of using a challenge is that it prevents man-in-the-middle attacks, since the authentication message is different each time (whereby a fixed message would allow the "man in the middle" to replay a recorded sequence of packets associated with the password passing, and hence falsely identify itself)
On the [badly worded] main question ("only being able to be decoded on the computer it resides on"...)
There exists several physical devices (dongles and such) as well as intrinsic identity indicators on a given computer (MAC addresses), along with logical constructs/contents on the hard disk (although we're getting in the "soft", i.e. more easily portable area here...), which can be used to identify a given host and thence supply the necessary elements (keys and such) to decode a message.
However, I believe this question was more generic:
It is possible for two computers to share, secretly, a key which they can use to exchange information that other computers could not decrypt (easily). These keys can either be put in place externally, or be negociated on the fly of each new session, using, initially, public key encryption for example as the Diffie-Hellman key exchange