Subtopic Notes

6.2 Data Integrity

6. Security, privacy and data integrity

Makes sure that the data entered is sensible (using validation) and accurate (using verification)

Validation

Checks whether the input data is reasonable, and meets the required criteria. (You must need to write algorithm)

  • Range Check: Checks if an input number is within acceptable values. Eg. Checking if age is greater than 18 and less than 80
  • Length Check: Checks if input has a precise number of characters or the length falls in a specific range. Eg. checking if phone number is exactly 11 digits
  • Type Check: Checks if data entered is of the required data type. Eg. Age field will only accept numbers
  • Presence Check: Checks if an input is given. Eg. Required fields in forms
  • Existence Check: Checks if the data entered exists or not. Eg. February 30 will be rejected since it does not exist
  • Format Check: Checks if data is in specified format. Eg. dd/mm/yy for date fields
  • Check Digit:
    • Final digit included in an identification number
    • The digit is calculated from other digits
    • Used in ISBN, License Plates, Barcodes

Verification

Verification ensures the input data matches the source or expected values accurately. Verification may happen during data entry or data transmission.

Entry Level

  • Double Entry
    • Input is given twice in separate fields
    • The program compares the values and rejects if they don't match
  • Visual Check
    • The program displays the data and gives a prompt to the user to confirm before proceeding

During Data Transfer

  • Parity Byte Check
    • Check is done with the number of 1-bits in a byte
    • Types -
      • Even Parity - Even number of 1-bits
      • Odd Parity - Odd numbers of 1-bits
    • Example (Even Parity)
      • 1111 0110
      • The LMB (Left-Most Bit) is the parity bit. As the number of 1s is odd, the parity bit would be set to 1 to even it out.
    • Limitations
      • Cannot identify alteration in bits despite having correct number of 1-bits
      • When error is checked, the bit(s) changed cannot be identified
  • Parity Block
    • Used to overcome parity check’s limitation
    • Rows and columns used to identify the changes in bits
    • Example (Uses even parity)
Parity byte
11010111
10101010
01010111
Parity byte00101000

The ones marked in bold are mistakes. Hence the one italic should be 0

  • Checksum
    • A value is calculated from a block of data using a specific algorithm
    • The checksum is sent along with the data
    • The receiver will calculate the checksum using the data
    • If the received checksum and calculated are the same, no error. If they don't match, request is made to resend data