Am I deceiving my former advisor? I did a successfull research project for my studies. My team created a software prototype and a promising evaluation therefore. It has potential for further research and eventually for an industry product.

The idea of the overall prototype is mine, but one core component originally comes from my advisor at that time. However, I reprogrammed it in another programming language and did several improvements on it, but the core algorithm is unchanged.

I eventually have the chance to do more about it, e.g. deliver it as a product to a company or get research fundings or a PhD grant. Therefore, I want to replace all code lines (~150) that I copied from my former advisor with own ones and leave him uninformed about what I am doing. Why?


As I said, the idea for the overall prototype was mine.
During the work with our advisor, I and my colleagues found him to be a difficult person. He has a tense and controlling attitude, which I think is distrustfull.
At the end of our project our team wanted to make our code Open Source. He refused.
He wanted to be informed about everything that I would do about the prototype. Especially, he wanted to have a veto about if regarding further scientific publications can be submitted. 


So, things will get complicated if I inform him about my procedure or use his unchanged code. 

Do you think this would be correct from an ethical and juristical perspective? What is your personal opinion about my thoughts and behaviour?

Furthermore, do you think my behaviour could have negative consequences for my potential academic career, since my former advisor works at a different chair on the same university? Is it possible, that my former advisor's boss will be notably pissed off by me?

Thanks in advance!
First of all you should inquire with your institution regarding intellectual property. Usually, there are some strict regulations in place. In my institution, for example, whatever is produced by the university's funding or using the university's equipment is at least to some point eligible to be the intellectual property of the university. Honestly, I've never heard of anyone who got into trouble with these regulations, but they're there, and should a feud arise, the institution will have the legal upper hand.

As you see, even if your code contained nothing of someone else's code (or other contributions - source code is not the only thing that makes a project), you could still expect some difficulties. 

Further, is the algorithm published, i.e. could I find a paper describing it and reimplement it to make a similar component as your adviser? If so, that puts you in a bit better position to use it without his consent, but I still wouldn't.

However, you still can't sell this product for your own benefit, without getting the consent and including all the parties that made a significant contribution. (Well, you could, of course, but that would be highly unethical and probably illegal) I do not see any obstacles in continuing research on your project, if you find a suitable department and new adviser whose interests happen to coincide with it. You could even find a way to improve you adviser's algorithm.

Finally, I would strongly advise against antagonizing you adviser (whether you are right or not). Remember, that you will need recommendation letters for your PhD studies. You should always try to maintain good relations with ex-collaborators (including your adviser), it's a lot easier to advance you career, if there are people who worked with you and have nice things to say about it, especially at the beginning of your career.

My advice is not to go behind anyone's back in your group. Your ideas are your own and nobody can prevent you from working on them in the future, so you have nothing to lose there. But, you shouldn't rely on those border cases, e.g. "if I took that and modified it slightly, would they still be able to sue me?. Talk to people, if you can't work things out, it is not the end of the world, you'll have to work on it more and come up with your own methods. As a byproduct you also get additional research material which is never a bad thing for a PhD candidate.