How to check Plagiarism?

Is there any way so that almost the same codes can be identified? if there is, please reply.