错误安全/纠正资源标识符
接收者是我的网站,发送者是相同的,但媒介很嘈杂,是一个用户。他将读取长度为 6 的字母数字代码,然后输入相同的代码来识别资源。我认为纠错码是一个很好的用途,我认为我应该把问题提出来,而不是进行研究。或者我可能会以错误的方式处理它,因为这种情况就像在每次传输时发送一本完美的字典一样。
代码的要求很简单:
- 6 个字母数字,从开始直到我用完为止。
- 如果用户弄错了,我仍然应该能够识别正确的资源。
- 没有一种资源比错误的资源更好。
- 易于编码或有免费的 .net 库 有
什么建议吗?
编辑:
在我看来,通过明智地选择代码(即代码之间有足够的距离)可以满足一半的要求。当我意识到代码生成的时间越长,它们就越不可能被使用时,这个策略看起来就更好了。
这些代码不会直接输入我的网站,因此我无法立即提供反馈。实际上,我们可以假设,除非我可以验证代码,否则我什至无法识别用户,因此我根本无法提供反馈。
The receiver is my website, the sender is the same but the medium is noisy, a user. He will read an alphanumeric code of length 6 and later input the same code to identify a resource. A good use for a error correcting code, I thought, and rather than do the research I thought I'd just put the question out there. Or I might be going about it the wrong way, since the situation is rather like sending a perfect dictionary along with every transmission.
The requirements on the code are simply:
- 6 alphanumeric digits, to start with until I run out, anyway.
- If the user gets it wrong I should still be able to identify the right resource.
- No resource is preferable to the wrong one.
- Easy to code or have free libraries for .net
Any suggestions?
Edit:
It seems to me that half the requirements can be fulfilled by choosing the codes wisely, i.e. with sufficient distance between them. This strategy looks even better when I realize that the longer it has been since the codes were generated, the more unlikely they are to be used.
The codes won't be directly typed into my website, so I can't give immediate feedback. Actually, we can assume that unless I can verify the code I can't even identify the user, so I can't really give feedback at all.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
嗯,不,您的第一个顺序方法应该是检查用户是否输入了正确的数字。 99% 的问题都是人为输入错误的数字或字符串造成的。这在实践中已得到很好的证实,校验位用于许多常见代码中,UPC 和 ISBN 是那些你每天都会看到的。您可以标记它,他们可以再次重新输入。
纠错码也很常见,但其应用却截然不同。传统上,它用于数字信号媒体,旨在检测和纠正比特错误。里德-所罗门(Reed-Solomon)是那里的百磅大猩猩,真正被音乐 CD 放在地图上。
这在实践中对人类来说效果并不好,他们会通过错误输入一个键而引入至少 6 位错误数据。这很难纠正,您必须向相邻字母添加大量冗余位,从而使代码更有可能被错误输入。人类可读代码的最佳方式是让代码对人类有意义。触发“看起来错误”响应的东西。就像一个名字一样,只要你不是弗兰克·扎帕的孩子。但除此之外,还有字母-字母+数字等代码的基础。等等。
Well, no, your first order approach should be to check if the user entered the right number. A human mistyping a number or string is 99% of the problem. That's well established in practice, the check digit is used in many common codes, UPC and ISBN being the ones that you'd see everyday. You can flag it, they can re-type it again.
Error correcting codes are common too but have a very different application. Traditionally it is used in digital signaling media, aiming to detect and correct bit errors. Reed-Solomon is the hundred pound gorilla there, really put on the map by the music CD.
That doesn't really work well in practice with a human, they'll introduce at least 6 bits of bad data by mis-typing one key. That's very hard to correct, you'd have to add lots and lots of redundancy bits to the adjacent letters, making it more likely for the code to be mis-typed. The best way for human-readable codes is for the code to make sense to a human. Something that triggers the 'that looks wrong' response. Like a given name, as long as you're not Frank Zappa's kid. But otherwise the foundation of codes like letter-letter + numbers. Etcetera.