简体   繁体   English

如何在Node.js中创建人类可读但机器不可读的文本?

[英]How can I create text that is human readable but not machine readable in Node.js?

I am making a simple mental math training app at https://mattea.app/ . 我正在https://mattea.app/上制作一个简单的心理数学训练应用程序。 It is a timed competition, and I measure the time you spend answering 10 exercises. 这是一场定时比赛,我会评估您花在回答10个练习上的时间。

The exercises are made on the server - in Node.js function served through Google Firebase Cloud Functions. 练习在服务器上进行-通过Google Firebase Cloud Functions服务于Node.js函数中。

One problem is that users can cheat by making a script that read the exercises and then programmatically calculate and submit the answers really quick. 一个问题是,用户可以通过编写一个脚本来作弊,该脚本可以阅读练习,然后以编程方式真正快速地计算并提交答案。 To make this harder, I return the execise as an SVG-tag, but each number turns into the same output each time, so it is not so hard to crack. 为了使这个更困难,我将execise作为SVG标签返回,但是每个数字每次都变成相同的输出,因此破解起来并不难。

How can the Node.js function return the exercise text (for instance "9x8") in format that is human readable but not so easily machine-readable? Node.js函数如何以人类可读但不太容易机器可读的格式返回练习文本(例如“ 9x8”)?

I ended up converting the number to a SVG path. 我最终将数字转换为SVG路径。 Later on I can add some randomness to the numbers in the path, so that it cannot easily be reversed. 稍后,我可以为路径中的数字添加一些随机性,以使它不易逆转。 Of course this could be reversed by an OCR algorithm, but at least it makes it a bit more work to do. 当然,OCR算法可以逆转这种情况,但是至少可以做更多的工作。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM