ctr_Repair/trunk/CardSaveDataMover/Imp/imp_list/digit.txt

46 lines
1008 B
Plaintext
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

本体印刷のシリアル最後尾の四角い枠に入った数字は
digitというものらしい
リスト作成時に入力違いをチェックするのに使えそう
コマンドラインでファイル指定する簡単なチェッカーとか
以下、長谷川さんメール抜粋
----------------
チェックデジットの計算方法は一般的なものらしく、
"モジュラス10 ウェイト3・1M10W31"というものらしいです。
// NULL終端されたシリアルナンバーを受け取る
// NULL文字の場所にチェックデジットを付加して新たにNULL終端する
void AddCheckDigit(char* serial)
{
size_t len = std::strlen(serial);
u8 digit = 0;
bool odd = true;
for(u8 i = len - 1; i > 0 && std::isdigit(serial[i]); i--)
{
if(odd)
{
digit += (serial[i] - '0') * 3;
}
else
{
digit += (serial[i] - '0');
}
odd = !odd;
}
if(digit % 10 != 0)
{
serial[len] = 10 - (digit % 10) + '0';
}
else
{
serial[len] = '0';
}
serial[len + 1] = '\0';
}