190 likes | 295 Views
2.2 Interfacing Computers MR JOSEPH TAN CHOO KEE TUESDAY 1330 TO 1530 http://computing2013.wiki.hci.edu.sg/. Error Detection & Correction. In computer science and telecommunication, error detection and correction or error control are techniques that enable
E N D
2.2 Interfacing Computers MR JOSEPH TAN CHOO KEE TUESDAY 1330 TO 1530 http://computing2013.wiki.hci.edu.sg/
Error Detection & Correction In computer science and telecommunication, • error detection and correction or error control are techniques that enable • reliable delivery of digital data over unreliable communication channels.
Why? Many communication channels are subject to channel noise, and thus errors may be introduced during transmission from the source to a receiver. • Error detection techniques allow detecting such errors, • Error correction enables reconstruction of the original data.
Purpose: Detecting Transmission Errors • Parity Check: Parity bit • Checksums The most common approach when any error is detected is retransmission.
Example: 7 data bits + 1 parity bit Parity Bit-Pattern 1 0 1 1 0 1 1 1 1 0 1 0 1 1 0 0 1 1 1 0 1 1 1 1 1 0 0 0 1 0 0 0 1 0 1 0 1 0 1 1 1 1 0 1 1 1 1 1 1 1 1 0 0 1 1 0 When will the parity bit be set? This is known as the Even parity bit Purpose: To make the total number of ‘ON’ bits even
Parity Bit-Pattern 1 1 1 1 0 1 1 1 0 0 1 0 1 1 0 1 1 1 1 0 1 1 0 1 1 0 0 0 1 0 0 1 1 0 1 0 1 1 1 1 1 1 0 1 1 1 0 0 1 0 0 1 1 0 0 0 Work out the Even parity bit?
Parity Bit-Pattern 1 0 1 1 0 1 1 1 1 0 1 0 1 1 0 0 1 1 1 0 1 1 1 1 1 0 0 0 1 0 0 0 1 0 1 0 1 0 1 1 1 1 0 1 1 1 1 1 1 0 0 1 1 0 0 1 When will the parity bit be set? This is known as the ODD parity bit Purpose: To make the total number of ‘ON’ bits ODD
Parity Bit-Pattern 1 1 1 1 0 1 1 1 0 0 1 0 1 1 0 1 1 1 1 0 1 1 0 1 1 0 0 0 1 0 0 1 1 0 1 0 1 1 1 1 1 1 0 1 1 1 0 0 1 1 1 0 0 1 1 1 Work out the Odd parity bit?
How does it work? Odd Parity Received Data Parity Bit-Pattern 1 1 1 1 1 0 0 1 Odd Parity Sent Data Parity Bit-Pattern 1 1 1 1 1 0 1 1 Received with Parity ‘1’ when it should be ‘0’ … => Data received with errors, detected
Loop holes: Odd Parity Received Data Parity Bit-Pattern 1 1 1 01 0 0 1 Odd Parity Sent Data Parity Bit-Pattern 1 1 1 1 1 0 1 1 2 data bits altered but parity bits reflects that it is correct. => Data received with errors but not detected
Check digit • Similar to the concept of check digit for bank account numbers • Check digit Approach • take the weighted sum of the digits, • modulo 10, with different weights for each number position • Weights: 5, 3, 2, 7 • Number to be coded: 4871 • 5×4 + 3×8 + 2×7 + 7×1 = 65 • 65 modulo 10 • Check digit would be 5 • Result: 48715.
Check digit • Similar to the concept of check digit for bank account numbers • Check digit Approach • take the weighted sum of the digits, • modulo 10, with different weights for each number position • Weights: 1, 2, 7, 8 • Number to be coded: 7898
Check digit • Similar to the concept of check digit for bank account numbers • Check digit Approach • take the weighted sum of the digits, • modulo 10, with different weights for each number position • Weights: 1, 2, 7, 8 • Number to be coded: 7898 • 7×1 + 8×2 + 9×7 + 8×8 = 150 • 150 modulo 10 • Check digit would be 0 • Result: 78980.
Checksums • Checksum is a fixed-size datum computed from an arbitrary block of digital data • for the purpose of detecting accidental errors • that may have been introduced during its transmission or storage. How to check for errors? • Re-computing the checksum and comparing it with the stored one Hash Function cipher text Plain text
MD5 • What is MD5 checksum? • Uses of MD5 Checksum • Checking the MD5
MD5 Checksum https://www.youtube.com/watch?v=2tuRHBkvbgs
MD5 Checksum • A hash function to check if a file is legit. • In Hexadecimal, 128 bits, 32 Characters • If the checksum matches the given than its legit else there is a possibility it is altered. • The checksum will be different for different file. • There are programs/utilities to calculate/compare MD5 Checksum. • MD5 Checksum are available for check. • Other Checksums: SHA-1, SHA-2 (Secure Hash Algorithm)
Disadvantage of any hash function • Hash Collision • 2 input value hash to the same result