There are tons of ways to show someone you are interested in getting to know them without explicitly revealing things about yourself
Initiate Contact:
If you are the one to approach someone else this shows immediate and obvious interest.
Ask Questions:
Especially detailed or open-ended questions. This demonstrates interest by showing that you want to know what they think about X. While keeping the focus of the conversation away from your own private life.
Use body language to show you are listening:
After you ask them a question, show them that you are interested in their answer by: smiling, nodding, making eye contact and reacting to the things they say.
Be engaged in the conversation:
Laughing, varying the pitch of your voice and talking about things you are genuinely interested in will go a long way.
Show appreciation:
After the conversation with them where you have done all the above things, you can deliver the final blow by directly, or subtly telling them that you were glad to get to know them, while expressing interest to do it again in the future.
Don't let personal questions about yourself ruin the flow of the conversation
After using the above techniques enough, it is inevitable that eventually some people will in turn be interested in your personal life, and it seems that here is where your problem is. Normally to deepen the friendship I would advise to open up, but since the objective of your question is the opposite, instead you should try and make sure you tactfully deflect these questions so that the interaction does not turn cold/awkward. While it is true that these things are personal to you and you are perfectly at liberty not to disclose them, that does not mean that you should make a big point about keeping them private. All relationships have a balance and if you are disclosing far less than the other person, (especially if you make a point of it) then they will feel uneasy and even hurt, which is probably why you have experienced some people acting "potentially hostile" when you stay silent.
Watch body language
If you suddenly visibly retract from the conversation, this draws attention to the fact that you don't want to share.
Don't go silent
When someone is waiting for an answer, one of the worst things you can do to draw attention to the fact you are not giving one is go silent as this will leave a large pause in the conversation in which people will take special note of you're silence and will prompt them to press you further.
Provide a non-answer
Responding to the question without giving the real answer that you did not want to disclose is a perfectly viable solution. For example:
Q: So, what do you think about {personal topic}?
A: Well one thing is for certain, I don't think it is as cool as {new topic}
This works because you kept the conversation flowing with interesting subjects by not flat out refusing to answer the question and not going silent, while still keeping your thoughts on the personal matter private.
Talk about something else
Whether you gave a non-answer like above, or were able to just ignore the question. Either way, talking about something an interesting subject shortly after will keep the conversation going normally and take the focus away from the question.