用于计算校验位的输入的技术术语是什么?

发布于 2024-09-28 07:53:52 字数 403 浏览 1 评论 0原文

例如:

code = '7777-5';
input = code.substring(0, 4);   // Returns '7777'
checkdigit = f(input);          // f() produces a checkdigit

assert.areEqual(code, input + "-" + checkdigit)

上面使用的input有技术术语吗?

具体来说,我正在计算ISBN的校验位,但这不应该影响答案。

For example:

code = '7777-5';
input = code.substring(0, 4);   // Returns '7777'
checkdigit = f(input);          // f() produces a checkdigit

assert.areEqual(code, input + "-" + checkdigit)

Is there a technical term for input used above?

Specifically I'm calculating checkdigits for ISBNs, but that shouldn't effect the answer.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

执着的年纪 2024-10-05 07:53:52

“不含校验位的原始数字”技术性够吗? :)

实际上,通常情况下,如您发布的链接中所示,校验位或校验和确保有关完整输入的属性:

...[校验位]必须使得所有十位数字的总和(每个数字乘以从 10 到 1 递减的整数权重)是数字 11 的倍数。

因此,您需要检查完整的数字看看它是否满足这个属性。

当您最初生成校验位时,它是“向后”的。在这种情况下,该函数将被命名为generate_check_digit或类似的,我只是将其参数命名为“input”。

Is "original number excluding the check digit" technical enough? :)

Actually, it's often the case, as in the link you posted, that the check digit or checksum ensures a property about the full input:

...[the check digit] must be such that the sum of all the ten digits, each multiplied by the integer weight, descending from 10 to 1, is a multiple of the number 11.

Thus, you'd check the full number and see if it meets this property.

It's "backwards" when you're initially generating the check digit. In that case, the function would be named generate_check_digit or similar, and I'd just name its parameter as "input".

吾性傲以野 2024-10-05 07:53:52

虽然我不确定输入是否有一个众所周知的特定技术术语,但 LukeH 建议的(消息/数据)似乎很常见。

校验和的 Wiki:

使用此校验和,任何翻转消息的单个位或奇数位的传输错误都将被检测为不正确的校验和

Wiki for 校验位:

校验位是一种用于错误检测的冗余校验形式,相当于二进制校验和的十进制。它由根据消息中其他数字计算得出的单个数字组成。

Although I am not sure if there is a well-known specific technical term for the input, what LukeH suggested (message/data) seems common enough.

Wiki for checksum:

With this checksum, any transmission error that flips a single bit of the message, or an odd number of bits, will be detected as an incorrect checksum

Wiki for check digit:

A check digit is a form of redundancy check used for error detection, the decimal equivalent of a binary checksum. It consists of a single digit computed from the other digits in the message.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文