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.
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”.
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.