Am I deceiving my former advisor?
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.