+ All Categories
Home > Documents > 1 01010000001001 by Colin Kriwox. 2 Contents Introduction credit card error checking what is a code...

1 01010000001001 by Colin Kriwox. 2 Contents Introduction credit card error checking what is a code...

Date post: 01-Apr-2015
Category:
Upload: nico-alexander
View: 222 times
Download: 0 times
Share this document with a friend
Popular Tags:
38
1 01010000001001 by Colin Kriwox
Transcript
Page 1: 1 01010000001001 by Colin Kriwox. 2 Contents Introduction credit card error checking what is a code purpose of error-correction codes Encoding naïve approach.

1

01010000001001

by Colin Kriwox

Page 2: 1 01010000001001 by Colin Kriwox. 2 Contents Introduction credit card error checking what is a code purpose of error-correction codes Encoding naïve approach.

2

Contents

Introductioncredit card error checkingwhat is a codepurpose of error-correction codes

Encodingnaïve approachhamming codes

Minimum Weight Theoremdefinitionsproof of single error-correction

Decodinglist all possible messagesusing vectorssyndrome

Conclusionperfect codes

Page 3: 1 01010000001001 by Colin Kriwox. 2 Contents Introduction credit card error checking what is a code purpose of error-correction codes Encoding naïve approach.

3

Detect Error On Credit Card

Page 4: 1 01010000001001 by Colin Kriwox. 2 Contents Introduction credit card error checking what is a code purpose of error-correction codes Encoding naïve approach.

4

Formula for detecting error

Let d2, d4, d6, d8, d10, d12, d14, d16 be all the even values in the credit card number.

Let d1, d3, d5, d7, d9, d11, d13, d15 be all the odd values in the credit card number.

Let n be the number of all the odd digits which have a value that exceeds four

Credit card has an error if the following is true:

(d1 + d3 + d5 + d7 + d9 + d11 + d13 + d15) x 2 + n +

(d2 + d4 + d6 + d8 + d10 + d12 + d14 + d16)

0 mod(10)

Page 5: 1 01010000001001 by Colin Kriwox. 2 Contents Introduction credit card error checking what is a code purpose of error-correction codes Encoding naïve approach.

5

Detect Error On Credit Card

d1

d2 d3 … d15 d16

n = 3

Page 6: 1 01010000001001 by Colin Kriwox. 2 Contents Introduction credit card error checking what is a code purpose of error-correction codes Encoding naïve approach.

6

Now the test(4 + 4 + 8 + 1 + 3 + 5 + 7 + 9) = 41

(5 + 2 + 1 + 0 + 3 + 4 + 6 + 8) x 2 + 3 = 61

41 + 61 = 102 mod (10) = 2

3

Page 7: 1 01010000001001 by Colin Kriwox. 2 Contents Introduction credit card error checking what is a code purpose of error-correction codes Encoding naïve approach.

7

Credit Card Summary

The test performed on the credit card number is called a parity check equation. The last digit is a function of the other digits in the credit card. This is how credit card numbers are generated by Visa and Mastercard. They start with an account number that is 15 digits long and use the parity check equation to find the value of the 16th digit.

“This method allows computers to detect 100% of single-position errors and about 98% of other common errors” (For All Practical Purposes p. 354).

Page 8: 1 01010000001001 by Colin Kriwox. 2 Contents Introduction credit card error checking what is a code purpose of error-correction codes Encoding naïve approach.

8

What is a code?

A code is defined as an n-tuple of q elements. Where q is any alphabet.

Ex. 1001 n=4, q={1,0}

Ex. 2389047298738904 n=16, q={0,1,2,3,4,5,6,7,8,9}

Ex. (a,b,c,d,e) n=5, q={a,b,c,d,e,…,y,z}

The most common code is when q={1,0}. This is known as a binary code.

Page 9: 1 01010000001001 by Colin Kriwox. 2 Contents Introduction credit card error checking what is a code purpose of error-correction codes Encoding naïve approach.

9

The purpose

A message can become distorted through a wide range of unpredictable errors.

• Humans

• Equipment failure

• Lighting interference

• Scratches in a magnetic tape

Page 10: 1 01010000001001 by Colin Kriwox. 2 Contents Introduction credit card error checking what is a code purpose of error-correction codes Encoding naïve approach.

10

Why error-correcting code?

To add redundancy to a message so the original message can be recovered if it has been garbled.

e.g. message = 10 code = 1010101010

Page 11: 1 01010000001001 by Colin Kriwox. 2 Contents Introduction credit card error checking what is a code purpose of error-correction codes Encoding naïve approach.

11

Send a message

Message Encoder Channel Decoder Message

10 101010 noise 001010 10

Page 12: 1 01010000001001 by Colin Kriwox. 2 Contents Introduction credit card error checking what is a code purpose of error-correction codes Encoding naïve approach.

12

Encoding

Naïve approach

Hamming codes

Page 13: 1 01010000001001 by Colin Kriwox. 2 Contents Introduction credit card error checking what is a code purpose of error-correction codes Encoding naïve approach.

13

Take Naïve approach

Append the same message multiple times. Then take the value with the highest average.

Message:= 1001

Encode:= 1001100110011001

Channel:= 1001100100011001

Decode: = a1 = Average(1,1,0,1) = 1

a2 = Average(0,0,0,0) = 0 ... (a1,a2,a3,a4)

Message:= 1001

Page 14: 1 01010000001001 by Colin Kriwox. 2 Contents Introduction credit card error checking what is a code purpose of error-correction codes Encoding naïve approach.

14

Hamming [7,4] Code

The seven is the number of digits that make the code.

E.g. 0100101

The four is the number of information digits in the code.

E.g. 0100101

Page 15: 1 01010000001001 by Colin Kriwox. 2 Contents Introduction credit card error checking what is a code purpose of error-correction codes Encoding naïve approach.

15

Hamming [7,4] Encoding

Encoded with a generator matrix. All codes can be formed from row operations on matrix. The code generator matrix for this presentation is the following:

1111000

0110100

1010010

1100001

G

Page 16: 1 01010000001001 by Colin Kriwox. 2 Contents Introduction credit card error checking what is a code purpose of error-correction codes Encoding naïve approach.

16

Hamming [7,4] Codes

1624 1000011010010100101100001111110011010101011001100011001101010100011001110100110010101111111011110000110010000000

12827

Codes

Possible codes

Page 17: 1 01010000001001 by Colin Kriwox. 2 Contents Introduction credit card error checking what is a code purpose of error-correction codes Encoding naïve approach.

17

Minimum Weight Theorem

Definitions

Proof of Theorem

Page 18: 1 01010000001001 by Colin Kriwox. 2 Contents Introduction credit card error checking what is a code purpose of error-correction codes Encoding naïve approach.

18

Definitions

The weight of a code is the number of nonzero components it contains.

e.g. wt(0010110) = 3

The minimum weight of Hamming codes is the weight of the smallest nonzero vector in the code.

e.g. d(G)= 3

1111000

0110100

1010010

1100001

G

Page 19: 1 01010000001001 by Colin Kriwox. 2 Contents Introduction credit card error checking what is a code purpose of error-correction codes Encoding naïve approach.

19

Definitions

The distance between two codes u and v is the number of positions which differ

e.g. u=(1,0,0,0,0,1,1)

v=(0,1,0,0,1,0,1)

dist(u,v) = 4

Another definition of distance is wt(u – v) = dist(u,v).

Page 20: 1 01010000001001 by Colin Kriwox. 2 Contents Introduction credit card error checking what is a code purpose of error-correction codes Encoding naïve approach.

20

Definitions

),(),(),( wvdistvudistwudist

),(),( uvdistvudist

0),( uudist

For any u, v, and w in a space V, the following three conditions hold:

Page 21: 1 01010000001001 by Colin Kriwox. 2 Contents Introduction credit card error checking what is a code purpose of error-correction codes Encoding naïve approach.

21

Definitions

The sphere of radius r about a vector u is defined as:

}),(|{)( rvudistVvuSr

e.g. u=(1,0,0,0,0,1,1) (0,0,0,0,0,1,1)

(1,1,0,0,0,1,1)

(1,0,0,0,0,0,1)

(1,0,0,0,0,0,1)

(1,0,1,0,0,1,1)

(1,0,0,1,0,1,1) (1,0,0,0,1,1,1)

Page 22: 1 01010000001001 by Colin Kriwox. 2 Contents Introduction credit card error checking what is a code purpose of error-correction codes Encoding naïve approach.

22

Minimum Weight Theorem

If d is the minimum weight of a code C, then C can correct t = [(d – 1)/2] or fewer errors, and conversely.

Page 23: 1 01010000001001 by Colin Kriwox. 2 Contents Introduction credit card error checking what is a code purpose of error-correction codes Encoding naïve approach.

23

Proof

Want to prove that spheres of radius t = [(d – 1)/2] about codes are disjoint. Suppose for contradiction that they are not. Let u and w be distinct vectors in C, and assume that )()( wSuSv tt

u wv

Page 24: 1 01010000001001 by Colin Kriwox. 2 Contents Introduction credit card error checking what is a code purpose of error-correction codes Encoding naïve approach.

24

Proof

By triangle inequality

twvdistvudistwudist 2),(),(),(

u wv

Page 25: 1 01010000001001 by Colin Kriwox. 2 Contents Introduction credit card error checking what is a code purpose of error-correction codes Encoding naïve approach.

25

Proof

12 dt12 dtdist(u,w)dist(u,v)dist(u,w)

Since spheres of radius t = [(d – 1)/2] so and this gives

But since

We have a contradiction. Showing the sphere of radius t about codes are disjoint.

dwuwtwudist )(),(

Page 26: 1 01010000001001 by Colin Kriwox. 2 Contents Introduction credit card error checking what is a code purpose of error-correction codes Encoding naïve approach.

26

Result of Theorem

Since d(G) = 3 then for t = [(3 – 1)/2] = 1 or fewer errors, the received code is in a disjoint sphere about a unique code word.

1111000

0110100

1010010

1100001

G

Page 27: 1 01010000001001 by Colin Kriwox. 2 Contents Introduction credit card error checking what is a code purpose of error-correction codes Encoding naïve approach.

27

Decoding

list all possible messages

using vectors

syndrome

Page 28: 1 01010000001001 by Colin Kriwox. 2 Contents Introduction credit card error checking what is a code purpose of error-correction codes Encoding naïve approach.

28

List all messages

This is done by generating a list of all the possible messages. For something small like the Hamming [7,4] codes the task is feasible, but for codes of greater length it is not. An example of a list is as follows:

Code words 1000011 0100101 0010110 … 0000011 0000101 0000110

Other 1000001 0100111 0010100Received 0010011 0001101 1010110Words 1100011 1100101 0110110

… … …

Page 29: 1 01010000001001 by Colin Kriwox. 2 Contents Introduction credit card error checking what is a code purpose of error-correction codes Encoding naïve approach.

29

List all messages

For example, if the received code was 0001101 then it would be decoded to 0100101 from the list.

Code words 1000011 0100101 0010110 … 0000011 0000101 0000110

Other 1000001 0100111 0010100Received 0010011 0001101 1010110Words 1100011 1100101 0110110

… … …

Page 30: 1 01010000001001 by Colin Kriwox. 2 Contents Introduction credit card error checking what is a code purpose of error-correction codes Encoding naïve approach.

30

Vector Decoding

Let a:=(0,0,0,1,1,1,1), b:=(0,1,1,0,0,1,1), and c:=(1,0,1,0,1,0,1).

1111000

0110100

1010010

1100001

G

),...,(: 71 xxx ),...,(: 71 yyy

7

1

)2mod(i

ii yxIf then inner product =

Page 31: 1 01010000001001 by Colin Kriwox. 2 Contents Introduction credit card error checking what is a code purpose of error-correction codes Encoding naïve approach.

31

Vector Decoding

cubuau ,,

1ua0ub

Correct errors by taking inner product of received vector u by a, b, c. We get

e.g. recall: a:=(0,0,0,1,1,1,1), b:=(0,1,1,0,0,1,1), and c:=(1,0,1,0,1,0,1).

Message Encoder Channel Decoder Message

1001 1001100 noise 1000100 ?

0uc

Error at 100 = digit 4. Decode to 1001100 and message equals 1001

Page 32: 1 01010000001001 by Colin Kriwox. 2 Contents Introduction credit card error checking what is a code purpose of error-correction codes Encoding naïve approach.

32

syndrome

Decodes without having to derive decoding vectors.

In addition to decoding Hamming [7,4] it can decode other codes

More feasible than a list of messages

Page 33: 1 01010000001001 by Colin Kriwox. 2 Contents Introduction credit card error checking what is a code purpose of error-correction codes Encoding naïve approach.

33

syndrome

The cosets of C are determined by }|{ Ccca

Some facts about cosets:

(i) Every coset of C has the same number of elements as C does

(ii) Any two cosets are either disjoint or identical

(iii) V is the union of all cosets of C

(iv) C has cosetsknq

Page 34: 1 01010000001001 by Colin Kriwox. 2 Contents Introduction credit card error checking what is a code purpose of error-correction codes Encoding naïve approach.

34

syndrome

A Coset leader is the vector with the minimum weight in the coset.

The parity check matrix is found by solving the generator matrix for 0TGH

Page 35: 1 01010000001001 by Colin Kriwox. 2 Contents Introduction credit card error checking what is a code purpose of error-correction codes Encoding naïve approach.

35

syndrome

The first step is to create a list of syndromes corresponding the coset leaders. The syndrome of each vector y is found by THyysyn )(

When a code is received, the syndrome is computed and compared to the list of syndromes. Let the coset leader to the syndrome by e. Finally the code is decoded to x = y – e.

Page 36: 1 01010000001001 by Colin Kriwox. 2 Contents Introduction credit card error checking what is a code purpose of error-correction codes Encoding naïve approach.

36

Syndrome example

1111000

0110100

1010010

1100001

G

1001011

0101101

0011110

H

Note that G=(I | A) and H = ( | I). TA

Page 37: 1 01010000001001 by Colin Kriwox. 2 Contents Introduction credit card error checking what is a code purpose of error-correction codes Encoding naïve approach.

37

Syndrome example

Let x:= 1001100 be the original message

Message Encoder Channel Decoder Message

1001 1001100 noise 1000100 ?

Compute the syndrome of the received codeTHyysyn )(

1001011

0101101

0011110

H

1

0

1

0

0

0

1

1

1

1

Page 38: 1 01010000001001 by Colin Kriwox. 2 Contents Introduction credit card error checking what is a code purpose of error-correction codes Encoding naïve approach.

38

Conclusion

A code of minimum weight d is called perfect if all the vectors in V are contained in the sphere of radius t = [(d – 1)/2] about the code-word.

The Hamming [7,4] code has eight vectors of sphere of radius one about each code-word, times sixteen unique codes. Therefore, the Hamming [7,4] code with minimum weight 3 is perfect since all the vectors (128) are contained in the sphere of radius 1.


Recommended