This was my thoughts exactly. If what the OP was proposing was not legitimate myself and countless others would be in legal jeopardy. I have written code that does the same thing at numerous employers because I am hired to solve the same problem. This doesn't mean I've copied anything, it just means I know what the hell I am doing.
If this was not legal, we would all be bound to the same employer for life. This could be extrapolated to virtually any employee. Have you assembled burgers for McDonald's before? If so, you can't work at Burger King, because they also make burgers and you have proprietary knowledge of McDonald's burgers.
I have spoken with numerous individuals who added support for specification X to one vendor's product, then did the same at the next job, so on and so forth. One individual had implemented the same specification for 3 different companies, all competitors, in just a few years. When you consider the breadth and depth of some specifications, the code doubtlessly is similar in form and obviously identical in function.