views:

34

answers:

2

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.

+1  A: 

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

Roger Pate
I was hoping that the answer would be a fun word that could be thrown around at parties or used to win games of trivial pursuit - everyone cheering for the victor because they knew this obscure word. But "original number excluding the check digit" just doesn't have that ring to it...
Gavin Miller
@Gavin: I hear you, just don't see it myself.
Roger Pate
+1  A: 

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.

YYC