C / C ++的抄袭检测的​​变量重命名 [英] Variable renaming for plagiarism detection for C/C++

查看:243
本文介绍了C / C ++的抄袭检测的​​变量重命名的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有几个简单的C ++作业,我知道学生共享代码。这些都是聪明的学生,他们知道如何欺骗苔藓。我正在寻找一个工具,可以重命名变量基于其类型(第一个变量的类型int将是int1,第一个int数组将是intptr1 ...),或做类似的,我现在不能想到的东西。你知道一个快速的方法吗?



编辑:我需要使用moss并报告90%匹配



谢谢

解决方案

是的,你要找的工具叫编译器。 除非标识符名称之外,如果提交的程序完全相同,请编译( >调试信息)应该产生完全相同的输出。



如果你这样做打开调试,编译器可能会在可执行文件中留下元数据,每个可执行文件,因此关于确保它关闭的评论。这也是为什么这不适用于Java程序 - 这种信息存在无论是否在调试模式(为动态内省的目的)。



EDIT:我从添加到该问题的评论中看到,您正在观察一些不同于标识符名称的提交。

/theory.stanford.edu/~aiken/moss/rel =nofollow> moss 是一个要求,这可能不是要走的路。我似乎虽然,moss有一些支持比较汇编 - 也许编译汇编和提交到moss是一个选项(取决于你使用的编译器)。


I have a couple of simple C++ homeworks and I know the students shared code. These are smart students and they know how to cheat moss. I'm looking for a tool that can rename variables based on their types (first variable of type int will be int1, first int array will be intptr1...), or does something similar that I cannot think of now. Do you know a quick way to do this?

edit: I'm required to use moss and report 90% match

Thanks

解决方案

Yep, the tool you're looking for is called a compiler. :)

Seriously, if the programs submitted are exactly the same except for the identifier names, compiling then (without debugging info) should result in exactly the same output.

If you do this with debugging turned on, the compiler may leave meta-data in the executable that is different for each executable, hence the comment about ensuring it is off. This is also why this wont work for Java programs - that kind of info is present whether in debug mode or not (for the purposes of dynamic introspection).

EDIT: I see from the comments added to the question that you're observing some submissions that are different in more than just identifier names. If the programs are still structurally equivalent, this should still work.

EDIT: Given that the use of moss is a requirement, this probably isn't the way to go. I does seem though that moss has some support for comparing assembly - perhaps compiling to assembler and submitting that to moss is an option (depending on what compiler you're using).

这篇关于C / C ++的抄袭检测的​​变量重命名的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆