Post on 02-Jun-2018
8/10/2019 Modulo Division
1/32
1/11/2015 1EED, NIT Calicut
8/10/2019 Modulo Division
2/32
If x is a non negative integer and y is a positiveinteger then we define x mod y to be theremainder when x is divided by y
x mod y= remainder(x/y)=x-int(x/y)*y It will be an integer from the set {0 1 2 3 4 5 6 7 8
9..y-1}
1/11/2015 EED, NIT Calicut 2
8/10/2019 Modulo Division
3/32
1/11/2015 EED, NIT Calicut 3
8/10/2019 Modulo Division
4/32
What day of the week will be 21 March 2012?
1/11/2015 EED, NIT Calicut 4
8/10/2019 Modulo Division
5/32
21 March 2011 is MONDAY There are 365 days in a regular year 7 days after 21.03.2011 is Monday
14 days after 21.03.2011 is Monday
Like that, 7n days after 21.03.2011 is Monday
So we find 365 mod 7
1/11/2015 EED, NIT Calicut 5
8/10/2019 Modulo Division
6/32
We get answer as 1 This means
If the year not a leap year, 21 March 2012 could
have been Tuesday
But year2012 is a Leap year
So 21.03.2012 shall be Wednesday
1/11/2015 EED, NIT Calicut 6
8/10/2019 Modulo Division
7/321/11/2015 EED, NIT Calicut 7
8/10/2019 Modulo Division
8/32
ISBN is International Standard Book Number There are two systems now in practice ISBN 10 and ISBN 13
ISBN 10 uses a 10 characters four field string ISBN 13 uses a 13 characters five field string Only decimal digits are used in the character string
From 1 January, 2007 , an ISBN consists of 13 digitspreceded by the letters ISBN.
1/11/2015 EED, NIT Calicut 8
8/10/2019 Modulo Division
9/32
8/10/2019 Modulo Division
10/32
Find the sum s=first digit x1 + second digit x 2 +third digit x 3 +.+ninth digit x 9
Then Check code=s mod 11
Eg. ISBN 81-203-0884-0 S=8+1*2+2*3+0*4+3*5+0*6+8*7+8*8+4*9 S=187
CC=187 mod 11=0 81-203-0884-0
1/11/2015 EED, NIT Calicut 10
8/10/2019 Modulo Division
11/32
ISBN 13 is a new code system introduced by ISO in2007
It has thirteen character five field string with last
field as the check code Field 1 Code for industry(978 or 979 for book publishing
industry)
Field 2 Area code /Group code
Field 3 Publisher Code Field 4 -Book Code
Field 5 Single digit Check Code
1/11/2015 EED, NIT Calicut 11
8/10/2019 Modulo Division
12/32
The check code is calculated as follows Each of the first 12 digits of the ISBN is alternately
multiplied by 1 and 3.
The check digit is equal to 10 minus the remainderresulting from dividing the sum of the weightedproducts of the first 12 digits by 10 with one
exception. If this calculation results in an apparent check digit
of 10, the check digit is 0.
1/11/2015 EED, NIT Calicut 12
8/10/2019 Modulo Division
13/32
8/10/2019 Modulo Division
14/32
ISBN 978- 0-070-60168-0 ISBN 979-81-77-58358-7
1/11/2015 EED, NIT Calicut 14
8/10/2019 Modulo Division
15/32
0 or 1 for English 2 for French 3 for German
4 for Japan 5 for Russia 7 for China
81 for India 9971 for Singapore .
1/11/2015 EED, NIT Calicut 15
8/10/2019 Modulo Division
16/32
Raja Rammohun Roy National Agency for ISBN
Ministry of HRD
A2/W4, Curzon Road Barracks,
Kasturba Gandhi Marg,
New Delhi-110001
Telephone No. 23384687, 23382549 (Extn. 12)
1/11/2015 EED, NIT Calicut 16
8/10/2019 Modulo Division
17/32
1/11/2015 EED, NIT Calicut 17
8/10/2019 Modulo Division
18/32
Cryptology is the science of encrypting anddecrypting messages for maintaining informationsecurity
1/11/2015 EED, NIT Calicut 18
8/10/2019 Modulo Division
19/32
8/10/2019 Modulo Division
20/32
Caesar encryption method can be represented bythe function f that assigns to the non negativeinteger p, p25 with f(p)=(p+3) mod 26
1/11/2015 EED, NIT Calicut 20
8/10/2019 Modulo Division
21/32
Code the word SECRET using Caesar method
1/11/2015 EED, NIT Calicut 21
8/10/2019 Modulo Division
22/32
{A B C D E F G H I J K L M N O P Q R S T U V W X Y Z} {0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
22 23 24 25}
1/11/2015 EED, NIT Calicut 22
8/10/2019 Modulo Division
23/32
1/11/2015 EED, NIT Calicut 23
{
A B C D E F G H I J K L M N O P Q R S T U V W X Y Z
0 1 2 3 4 5 6 7 8 9 10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
8/10/2019 Modulo Division
24/32
8/10/2019 Modulo Division
25/32
Original Message is obtained from the secret codeusing decryption using
f -1 =(p-3)mod 26
This is only a simple method of encryption, whichcan be easily hacked
There are several algorithms for encrypting
messages
1/11/2015 EED, NIT Calicut 25
8/10/2019 Modulo Division
26/32
1/11/2015 EED, NIT Calicut 26
8/10/2019 Modulo Division
27/32
PRN is a sequence of numbers which shows certaindegree of statistical independence required for arandom number sequence
But it is not purely random. So we call it as pseudo random sequence
1/11/2015 EED, NIT Calicut 27
8/10/2019 Modulo Division
28/32
PRN can be generated on the computer usingseveral techniques
The Linear Congruential method is very popular
That is, we generated a sequence of pseudorandom numbers {xn} with 0xn
8/10/2019 Modulo Division
29/32
x0is called the seed It is seen that m=231-1, a=75, c=0 Then m=2,147,483,647
And a=16807 This sequence about 2147 million random numbers
1/11/2015 EED, NIT Calicut 29
8/10/2019 Modulo Division
30/32
Use m=9, a=7, c =4, and x0=3 and generate the first12 random numbers
1/11/2015 EED, NIT Calicut 30
8/10/2019 Modulo Division
31/32
3,7, 8,6,1,2,0,4,5,3,7,8
We find that the sequence gets repeated after 9
numbers, which is the period length of the PRNsequence for m=9
This repetition happens for any PRN sequence for a
given m, a and x0
1/11/2015 EED, NIT Calicut 31
8/10/2019 Modulo Division
32/32
Hashing is the process of mapping a key to amemory location based on the Hash valuecalculated for the Key using a Hash function
One of the method of Hash function uses theModulo mdivision technique in which the result ofthe Modulo division gives the location/address of
the Key in the HASH TABLE