Example:
PCB Number = CEA79C1234567890
Step 1
Take 1st digit („C‟) and Convert to Decimal („12‟)
Take 2nd digit („E‟) and Convert to Decimal („14‟)
XOR 1st digit (‟12‟) with to 2nd digit („14‟) Store Answer as „CALCULATION_NO‟ („2‟)
Take 3rd digit („A‟) and Convert to Decimal („10‟)
XOR „CALCULATION_NO‟ with to 3rd digit („10‟) Store Answer as „CALCULATION_NO‟ („8‟)
Take 4th digit („7‟)
XOR „CALCULATION_NO‟ with to 4th digit („7‟) Store Answer as „CALCULATION_NO‟ („15‟)
Take 5th digit („9‟)
XOR „CALCULATION_NO‟ with to 5th digit („9‟) Store Answer as „CALCULATION_NO‟ („6‟)
Take 6th digit („C‟) and Convert to Decimal („12‟)
XOR „CALCULATION_NO‟ with to 6th digit („12‟) Store Answer as „CALCULATION_NO‟ („10‟)
Take 7th digit („1‟)
XOR „CALCULATION_NO‟ with to 7th digit („1‟) Store Answer as „CALCULATION_NO‟ („11‟)
Take 8th digit („2‟)
XOR „CALCULATION_NO‟ with to 8th digit („2‟) Store Answer as „CALCULATION_NO‟ („9‟)
Take 9th digit („3‟)
XOR „CALCULATION_NO‟ with to 9th digit („3‟) Store Answer as „CALCULATION_NO‟ („10‟)
Take 10th digit („4‟)
XOR „CALCULATION_NO‟ with to 10th digit („4‟) Store Answer as „CALCULATION_NO‟ („14‟)
Take 11th digit („5‟)
XOR „CALCULATION_NO‟ with to 11th digit („5‟) Store Answer as „CALCULATION_NO‟ („11‟)
Take 12th digit („6‟)
XOR „CALCULATION_NO‟ with to 12th digit („6‟) Store Answer as „CALCULATION_NO‟ („13‟)
Take 13th digit („7‟)
XOR „CALCULATION_NO‟ with to 13th digit („7‟) Store Answer as „CALCULATION_NO‟ („10‟)
Take 14th digit („8‟)
XOR „CALCULATION_NO‟ with to 14th digit („8‟) Store Answer as „CALCULATION_NO‟ („2‟)
Take 15th digit („9‟)
XOR „CALCULATION_NO‟ with to 15th digit („9‟) Store Answer as „CALCULATION_NO‟ („11‟)
Take 16th digit („0‟)
XOR „CALCULATION_NO‟ with to 16th digit („0‟) Store Answer as „CALCULATION_NO‟ („11‟)
If „CALCULATION_NO‟ = 1 or 2 or 4 or 7 or 8 or 11 or 13 or 14 then Set „XOR_NUMBER‟ = 1, else „XOR_NUMBER = 0 (XOR_NUMBER = 0)
„CHECKSUM‟ = „XOR_NUMBER‟ (CHECKSUM = 1)
Step 2
Take 1st digit („C‟) and Convert to Decimal („12‟)
Take 2nd digit („E‟) and Convert to Decimal („14‟)
XOR 1st digit (‟12‟) with to 2nd digit („14‟) Store Answer as „CALCULATION_NO‟ („2‟)
Take 3rd digit („A‟) and Convert to Decimal („10‟)
XOR „CALCULATION_NO‟ with to 3rd digit („10‟) Store Answer as „CALCULATION_NO‟ („8‟)
Take 4th digit („7‟)
XOR „CALCULATION_NO‟ with to 4th digit („7‟) Store Answer as „CALCULATION_NO‟ („15‟)
Take 5th digit („9‟)
XOR „CALCULATION_NO‟ with to 5th digit („9‟) Store Answer as „CALCULATION_NO‟ („6‟)
Take 6th digit („C‟) and Convert to Decimal („12‟)
XOR „CALCULATION_NO‟ with to 6th digit („12‟) Store Answer as „CALCULATION_NO‟ („10‟)
Take 7th digit („1‟)
XOR „CALCULATION_NO‟ with to 7th digit („1‟) Store Answer as „CALCULATION_NO‟ („11‟)
Take 8th digit („2‟)
XOR „CALCULATION_NO‟ with to 8th digit („2‟) Store Answer as „CALCULATION_NO‟ („9‟)
If „CALCULATION_NO‟ = 1 or 2 or 4 or 7 or 8 or 11 or 13 or 14 then Set „XOR_NUMBER‟ = 1, else „XOR_NUMBER = 0 (XOR_NUMBER = 0)
„CHECKSUM‟ = „CHECKSUM‟ + (2 * „XOR_NUMBER‟) (CHECKSUM = 1)
Step 3
Take 1st digit („C‟) and Convert to Decimal („12‟)
Take 2nd digit („E‟) and Convert to Decimal („14‟)
XOR 1st digit (‟12‟) with to 2nd digit („14‟) Store Answer as „CALCULATION_NO‟ („2‟)
Take 3rd digit („A‟) and Convert to Decimal („10‟)
XOR „CALCULATION_NO‟ with to 3rd digit („10‟) Store Answer as „CALCULATION_NO‟ („8‟)
Take 4th digit („7‟)
XOR „CALCULATION_NO‟ with to 4th digit („7‟) Store Answer as „CALCULATION_NO‟ („15‟)
Take 9th digit („3‟)
XOR „CALCULATION_NO‟ with to 9th digit („3‟) Store Answer as „CALCULATION_NO‟ („12‟)
Take 10th digit („4‟)
XOR „CALCULATION_NO‟ with to 10th digit („4‟) Store Answer as „CALCULATION_NO‟ („8‟)
Take 11th digit („5‟)
XOR „CALCULATION_NO‟ with to 11th digit („5‟) Store Answer as „CALCULATION_NO‟ („13‟)
Take 12th digit („6‟)
XOR „CALCULATION_NO‟ with to 12th digit („6‟) Store Answer as „CALCULATION_NO‟ („11‟)
If „CALCULATION_NO‟ = 1 or 2 or 4 or 7 or 8 or 11 or 13 or 14 then Set „XOR_NUMBER‟ = 1, else „XOR_NUMBER = 0 (XOR_NUMBER = 1)
„CHECKSUM‟ = „CHECKSUM‟ + (4 * „XOR_NUMBER‟) (CHECKSUM = 5)
Step 4
Take 1st digit („C‟) and Convert to Decimal („12‟)
Take 2nd digit („E‟) and Convert to Decimal („14‟)
XOR 1st digit (‟12‟) with to 2nd digit („14‟) Store Answer as „CALCULATION_NO‟ („2‟)
Take 5th digit („9‟)
XOR „CALCULATION_NO‟ with to 5th digit („9‟) Store Answer as „CALCULATION_NO‟ („11‟)
Take 6th digit („C‟) and Convert to Decimal („12‟)
XOR „CALCULATION_NO‟ with to 6th digit („12‟) Store Answer as „CALCULATION_NO‟ („7‟)
Take 9th digit („3‟)
XOR „CALCULATION_NO‟ with to 9th digit („3‟) Store Answer as „CALCULATION_NO‟ („4‟)
Take 10th digit („4‟)
XOR „CALCULATION_NO‟ with to 10th digit („4‟) Store Answer as „CALCULATION_NO‟ („0‟)
Take 13th digit („7‟)
XOR „CALCULATION_NO‟ with to 13th digit („7‟) Store Answer as „CALCULATION_NO‟ („7‟)
Take 14th digit („8‟)
XOR „CALCULATION_NO‟ with to 14th digit („8‟) Store Answer as „CALCULATION_NO‟ („15‟)
If „CALCULATION_NO‟ = 1 or 2 or 4 or 7 or 8 or 11 or 13 or 14 then Set „XOR_NUMBER‟ = 1, else „XOR_NUMBER = 0 (XOR_NUMBER = 0)
„CHECKSUM‟ = „CHECKSUM‟ + (8 * „XOR_NUMBER‟) (CHECKSUM = 5)
Step 5
PCB SN = CEA79C12345678905
使用Oracle函数手动计算过程:
SN:CEA79C1234567890
STEP 1:
取值1~16个
select utl_raw.bit_xor('C','E') from dual
select utl_raw.bit_xor('02','A') from dual
select utl_raw.bit_xor('08','7') from dual
select utl_raw.bit_xor('0F','9') from dual
select utl_raw.bit_xor('06','C') from dual
select utl_raw.bit_xor('0A','1') from dual
select utl_raw.bit_xor('0B','2') from dual
select utl_raw.bit_xor('09','3') from dual
select utl_raw.bit_xor('0A','4') from dual
select utl_raw.bit_xor('0E','5') from dual
select utl_raw.bit_xor('0B','6') from dual
select utl_raw.bit_xor('0D','7') from dual
select utl_raw.bit_xor('0A','8') from dual
select utl_raw.bit_xor('02','9') from dual
select utl_raw.bit_xor('0B','0') from dual
select to_number(utl_raw.cast_to_binary_integer('0B')) from dual
结果为11
CHECKSUM=1
STEP 2:
取值1~8
select utl_raw.bit_xor('C','E') from dual
select utl_raw.bit_xor('02','A') from dual
select utl_raw.bit_xor('08','7') from dual
select utl_raw.bit_xor('0F','9') from dual
select utl_raw.bit_xor('06','C') from dual
select utl_raw.bit_xor('0A','1') from dual
select utl_raw.bit_xor('0B','2') from dual
select to_number(utl_raw.cast_to_binary_integer('09')) from dual
结果为9
CHECKSUM=1+2*0=1
STEP3:
取值1~4 & 9~12
select utl_raw.bit_xor('C','E') from dual
select utl_raw.bit_xor('02','A') from dual
select utl_raw.bit_xor('08','7') from dual
select utl_raw.bit_xor('0F','3') from dual
select utl_raw.bit_xor('0C','4') from dual
select utl_raw.bit_xor('08','5') from dual
select utl_raw.bit_xor('0D','6') from dual
select to_number(utl_raw.cast_to_binary_integer('0B')) from dual
结果为11
CHECKSUM=1+4*1=5
STEP4:
取值1~2&5~6&9~10&13~14
select utl_raw.bit_xor('C','E') from dual
select utl_raw.bit_xor('02','9') from dual
select utl_raw.bit_xor('0B','C') from dual
select utl_raw.bit_xor('07','3') from dual
select utl_raw.bit_xor('04','4') from dual
select utl_raw.bit_xor('00','7') from dual
select utl_raw.bit_xor('07','8') from dual
select to_number(utl_raw.cast_to_binary_integer('0F')) from dual
结果为15
CHECKSUM=5+8*0=5
SN:CEA79C12345678905