Contracts have their own key-value storage in Ethereum. My question is - is the data saved in that storage publicly accessible, or can it be programmed to only allow access to certain parties and disallow to the rest?
For example, let's say I want to design a contract that allows users to save their passwords on the blockchain. Naturally, I'd like to ensure that each user is the only one with access to his own password. In this case, once a user submits his password for the first time - it is written as the entry: user --> password. Then, if the user wants to retrieve the password, he will issue another message to the contract asking for the password. Since his identity will be verified, he will get his password.
The question is - can anyone else access the data? Is it public on the ethereum blockchain (as is the case with other blockchains)?
* Note: Needless to say, this is not a real use-case, just an example to illustrate my question.