A code similarity detection method and system based on relational variable graph

A detection method and variable graph technology, applied in the field of code similarity detection based on relational variable graphs, can solve the problems of high space-time complexity, low detection accuracy, difficulty in dealing with redundant code implantation, etc., and achieve reduced complexity and strong The effect of anti-interference ability

Active Publication Date: 2022-04-08
XIANGTAN UNIV
View PDF4 Cites 0 Cited by
  • Summary
  • Abstract
  • Description
  • Claims
  • Application Information

AI Technical Summary

Problems solved by technology

[0003] At present, the existing methods of code duplication checking are all based on statistical methods based on string matching, methods based on Token, and methods based on program structure diagrams, but these methods have their shortcomings, such as , the detection accuracy of the statistical method based on string matching is low, and it cannot cope with the modification of variable names and the implantation of redundant codes; the detection accuracy of the Token-based method is low, although it can resist confusion such as replacing variable names and modifying function locations , but its anti-obfuscation ability is low, and it is difficult to deal with the implantation of redundant codes; the method based on the program structure diagram has high precision, but its calculation time and space complexity is high, which brings inconvenience to the heavy checking work with a large amount of tasks

Method used

the structure of the environmentally friendly knitted fabric provided by the present invention; figure 2 Flow chart of the yarn wrapping machine for environmentally friendly knitted fabrics and storage devices; image 3 Is the parameter map of the yarn covering machine
View more

Image

Smart Image Click on the blue labels to locate them in the text.
Viewing Examples
Smart Image
  • A code similarity detection method and system based on relational variable graph
  • A code similarity detection method and system based on relational variable graph
  • A code similarity detection method and system based on relational variable graph

Examples

Experimental program
Comparison scheme
Effect test

Embodiment 2

[0092] figure 2 It is a schematic structural diagram of a code similarity detection system based on a relational variable graph in an embodiment of the present invention, as figure 2 As shown, the code similarity detection system based on the relationship variable graph provided in this embodiment includes:

[0093] The removing module 100 is used for removing the comment information in the original code and the detection code.

[0094] The identifier determination module 200 is configured to determine the identifiers that have a transfer data relationship between the processed original code and the processed detection code.

[0095]Corresponding relationship determining module 300, configured to determine a first corresponding relationship and a second corresponding relationship; the first corresponding relationship is the corresponding relationship between identifiers in the processed original code; the second corresponding relationship is the corresponding relationship i...

Embodiment 3

[0099] This embodiment provides a code similarity detection method based on a relational variable graph, the method comprising:

[0100] Step 1, removing comment information in the code program; the code program includes original code and detection code.

[0101] Step 1 plays an auxiliary role in code detection. Removing comment information and header file information is beneficial to the extraction of subsequent identifiers and relationships. The specific steps include:

[0102] Remove the comment information in the code, such as: the content between / ** / and the content after / / , and remove the imported header file information.

[0103] Step 2, extracting identifiers that can transfer data relations in the processed code program.

[0104] The purpose of step 2 is to extract the identifier that can transfer the data relationship in the code, which is to lay the foundation for extracting the relationship later. The specific steps include:

[0105] Here, the C language progra...

the structure of the environmentally friendly knitted fabric provided by the present invention; figure 2 Flow chart of the yarn wrapping machine for environmentally friendly knitted fabrics and storage devices; image 3 Is the parameter map of the yarn covering machine
Login to view more

PUM

No PUM Login to view more

Abstract

The invention discloses a code similarity detection method and system based on a relational variable graph, and relates to the field of code similarity detection, including removing comment information in original code and detection code; determining the processed original code and the processed detection code Identifiers with transfer data relationship; determine the first corresponding relationship and the second corresponding relationship; the first corresponding relationship is the corresponding relationship between the identifiers in the processed original code; the second corresponding relationship is the processed detection code The corresponding relationship between the identifiers in the corresponding relationship; establish the first directed relational variable graph according to the first corresponding relation, and establish the second directed relational variable graph according to the second corresponding relation; calculate the first directed relational variable graph and the second directed relational variable graph To determine the similarity between the original code and the detection code. By adopting the method or system provided by the present invention, the similarity between codes with many modified parts and the original codes can be detected more efficiently.

Description

technical field [0001] The invention relates to the field of code similarity detection, in particular to a code similarity detection method and system based on a relational variable graph. Background technique [0002] In today's information age, in the field of education, many students respond to the academic tasks assigned by the teacher by applying other people's programs or modifying the programs of their classmates online, which brings great trouble to the teacher's teaching assessment; while in the commercial field, Many companies and individuals use the programs in other people's projects privately for their own projects, causing various rights disputes. Therefore, how to effectively check the code has gradually attracted people's attention. [0003] At present, the existing methods of code duplication checking are all based on statistical methods based on string matching, methods based on Token, and methods based on program structure diagrams, but these methods have...

Claims

the structure of the environmentally friendly knitted fabric provided by the present invention; figure 2 Flow chart of the yarn wrapping machine for environmentally friendly knitted fabrics and storage devices; image 3 Is the parameter map of the yarn covering machine
Login to view more

Application Information

Patent Timeline
no application Login to view more
Patent Type & Authority Patents(China)
IPC IPC(8): G06F8/75
Inventor 邹娟伍兵侯长民聂奇隆安晨陈勇邓彬沈鹏郑金华
Owner XIANGTAN UNIV
Who we serve
  • R&D Engineer
  • R&D Manager
  • IP Professional
Why Eureka
  • Industry Leading Data Capabilities
  • Powerful AI technology
  • Patent DNA Extraction
Social media
Try Eureka
PatSnap group products