I think I would get quite heavy with a 12 year old on this.
Sit her down and talk to her first about safety and security. That good parents of people her age know their passwords, as it is the first rule of safe communication. That in your home, you wish to see her safe and that if she is not willing for you to have the password, then she isn't having the phone.
Then go on to speak to her about her dad's communication. You could lead on from talking about safety to talking about each parent's responsibility to work together to make sure their children feel safe and supported. Does she ever hear you saying nasty things about her Dad? No. Does she think that you sometimes don't agree with what he says and does? Yes of course. But you don't make her life harder by talking to her about that and making her take sides. You ESPECIALLY don't put her in danger by encouraging her to lie to her dad, by making her think that lying is ok. It's a horrid horrid thing to do, you are sure it makes her feel uncomfortable, so you don't do it. Most of all, it's DANGEROUS. Lying to your parents makes you less safe, because if you don't know what she is doing and where she is, if she ever gets in trouble, you can't help her.
So you look her in the eye and say - your dad is not helping you here. He is making you take sides, and that makes you less safe and less supported. I want to know what he says to you so that you don't have to feel uncomfortable making choices to tell me or not. I need to know what your dad says to you so that if there is a problem, I can go straight to him. In return, you know that anything I say to you, you can tell him. There is not a problem with that either. Hopefully, if your dad knows that I would be able to see messages he might send you, he will stop telling you to lie to me and other things that make your life more difficult. But that's for him and me to sort out and not something you should be worrying about. But don't think for one MUNUTE that when you are under my roof, you will be able to lie to me and keep important things from me, or have a password on your phone under my roof until you are a LOT older.
As for your messages to your friends, they are your business, in the same way that if you wanted to, you could go into my bedroom or my handbag and go through my things, but I trust you not to.