Is there a way to check if two notebook files have the same source or they were shared by two users. I send pre-filled notebooks to my students to get into Wolfram Mathematica. However is very easy for people to cheat passing files each other.

I tried using UUID[], but I cannot hide it from the output, so student could see it, and just rerun the cells.

Can I include some elements that allow me to identify if people share the file? Some kind of run history, the WolfranID o a kind of watermark that tells me who originally fill and run the file?


UPDATE: I found this thread that suggests of using the Cell Notebook History capability, and I think it could work. Because a person just take someone's else file, change the name and summit, will be registered there. But, there is a way to acces that info with some programming instead of using the front end menu?

  • 3
    $\begingroup$ Cells with identical CellChangeTimes that are later than the time the notebooks were given out (or later than when you last edited the notebook) would be suspicious. The times are measured in hundredths of seconds. There are ways an evil genius could evade detection, but I wonder if thwarting evil geniuses of this type should be a priority. $\endgroup$
    – Michael E2
    Nov 17, 2021 at 4:13
  • 3
    $\begingroup$ In many universities collaborative work is welcomed. Science and industry heavy rely on people that can work in a team. I would not be calling this "cheating". $\endgroup$
    – yarchik
    Nov 17, 2021 at 7:31
  • $\begingroup$ What about "$MachineID" $\endgroup$ Nov 17, 2021 at 8:57
  • 2
    $\begingroup$ @yarchik collaboration is good, but simply getting a copy of someone else's work because you were too lazy is not good... However, it is of course possible that two students collaborate on one single computer, and then the notebook would of course be identical, even though there was no cheating involved. Anyway, I suppose that OP would not simply fail a student for having an identical notebook, but would rather focus a few extra questions to those students to see that they have actually understood the problems and solutions. $\endgroup$
    – a20
    Nov 17, 2021 at 9:32
  • 1
    $\begingroup$ Anti-cheating strategies depend on what subject you teach, #students, #cheaters, what corrective/punitive action they face when they get caught and (to keep this list finite) how many TAs you have. Odds are stacked against the teacher, i think. Above all, it depends on how much extra/wasted effort you want to invest in societal reform. You sound more interested in proving that someone has cheated. It tells me all I want to know about working conditions & the deteriorating state of society that you find yourself in. Use time/energy to improve your own skills and to advance your career. $\endgroup$
    – Syed
    Nov 17, 2021 at 10:00

2 Answers 2


You could tag a notebook with an encrypted identifier.

studentID = "Albert Einstein's notebook 42";
encryptedID = Compress[Encrypt["password", studentID]];
SetOptions[EvaluationNotebook[], TaggingRules -> {"innocuousTag" -> encryptedID}];

Then when you open it you can check the identity.

readID = Uncompress[CurrentValue[{TaggingRules, "innocuousTag"}]];
Decrypt["password", readID]

"Albert Einstein's notebook 42"

The tag is not immediately visible, and it could stop simple copying.

A resourceful cheat could replace the tag with the one from their own notebook. Of course, alternatively they could simply fill in their own notebook with the answers from the completed one.

  • $\begingroup$ I really like this solution. I had the thought that you could also do a canary trap by adding a unique typo or something to each notebook, but this is much neater. $\endgroup$
    – Carl Lange
    Nov 17, 2021 at 14:15
  • $\begingroup$ @CarlLange your link suggests using zero-width characters and that is a reasonable suggestion here. $\endgroup$
    – user253751
    Nov 17, 2021 at 17:27
  • $\begingroup$ Thanks @Chris. But this code, shoud I put in a regular cell or I need to edit the notebook manually. Sorry, I kind of new with Wolfram. Or if you can point me into a doc to read through to know about it. Thanks. $\endgroup$
    – Or1on
    Nov 17, 2021 at 22:17
  • 1
    $\begingroup$ @Or1on Most basically you can paste in and execute the first cell in the notebook to place the tag, then delete the cell. The tag remains in the notebook structure, (visible if you look at the file in a plain text editor). To read the tag, paste in and evaluate the second cell. You can do that to see how it works, but practically some kind of automation would be used. Such as: using a master notebook, open the original student notebook, tag it with ID details, write it to student's directory or email it. See docs : reference.wolfram.com/language/tutorial/… $\endgroup$ Nov 17, 2021 at 22:44

The notebook is a text-file. You can add any markers inside it as a (*comment*) by any text editors outside the "Notebook Content" section. These comments are invisible from Mathematica and you can hide it inside the inner data of Mathematica making the ID numerical or using senseless strings.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.