Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                

Cryptography: Via DMS: Ankit

Download as pptx, pdf, or txt
Download as pptx, pdf, or txt
You are on page 1of 20

Cryptography

Ankit

:
Applications of functions
via DMS
in cryptography
(Mod/Hash)
Ankit Kumar Amarjeet Kumar

IT-24 IT-19
Ankit
Mod function
Definition,example,some formula,

Hash function
Definitions, key points, Example.

Cryptography
Overlook, caesar cipher,hashing as password
encryption

Conclusion
Mod function simply tell you the
Amarjeet remainder when a no is divided by
divisor so what is remainder.
Note that a remainder cannot be greater
The mighty mod than divisor.
This property is of greater importance
function For ex- 3 mod 2 =1
that helps to concise the outputwe would
see in further slides,

Mod
we define the modulo n function as follows:
If x = qn + r, 0 ≤ r < n, then x mod n = r.
In other words, x mod n is the nonnegative r
emainder (also called the residue of x modu
lo n) when x is divided by the positive integ
er n. This seemingly innocuous function tur
ns up in a surprising number of applications
, some of which will be explored in further s
ections

function
Amarjeet

Clock Arithmetic
Military time uses a 24-hour clock whereas, Standard time uses am
and pm

Conversion from military time to standard time uses t

Mod
he modulo 12 function:
8:00 military time: Compute 8 mod 12 = 8 gives 8:00 am standard time
6:00 military time:Compute 16 mod 12 = 4 gives 4:00 pm standard time
The am or pm designation is determined by whether the quotient in the d
ivision is 0 (am) or 1 (pm). Counting modulo 12 begins at 0 and wraps ar
ound to 0 again when 12 is reached:
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 0, 1, 2, 3,…

function
These are some of formulas which
would simplify our computations
Amarjeet when dealing with large input.
Some mod operations
(x+y) mod n = (x mod n + y mod n) mod n
(x * y) mod n = {(x mod n * y mod n) mod n}

By above result,
220 mod 6 = (22 mod 6 * 10 mod 6) mod 6
= (4 * 4) mod 6 = 16 mod
6=4
In addition, spreadsheet software usually co
ntains a mod function that speeds up compu
tations.
Hashing
A hash function is a function h: S→ T where the domain S is a set of text strings or in
teger values, and the codomain T is the set of integers {0, 1, …, t − 1
where t is some relatively small positive integer.

Key points
• The function h maps a potentially large set of integer values S into a relatively sm
all window of integer values T.
• Consequently h isn’t likely to be a one-to-one function.Whatever the function h(x)
does to x, the last step is almost always to apply the mod t function so the final val
ue of h(x) falls in the codomain {0, 1, …, t − 1}
Ques S is a set of positive integers, T is the
set of integers (0, … , t − 1)and the hash
function h(x) is given by
h(x) = x mod t
If t = 10, for example,
Sol Then values are computed modulo 10:
h(7) = 7 mod 10 = 0
h(23) = 23 mod 10 = 3
Hashing
h(59) = 59 mod 10 = 9
h(158) = 158 mod 10 = 8
h(48) = 48 mod 10 = 8
Here 158 and 48 hash to the same value
Amarjeet

Computer Security
Towards a safer world
Amarjeet

Computer security

Computer security (or the more general term Cryptography


information assurance) is a topic of critical interest
In the adult world, military information, financial information, and
when our economy, defense, and indeed our
company proprietary information that must be transmitted securely . The
entire way of life depend so much on computers
original information (called the plaintext) is encrypted using an encryption
and information. The mod function plays a part in
key, resulting in coded text called the ciphertext. The ciphertext is
many aspects of security
transmitted and when it is received, it can be decoded using the

corresponding decryption key


some sense of crpyography to you.
So what is caesar cipher
Caesar cipher is a simple way of converting a message to
Amarjeet secret message. What we do is we shift every letter of
Ceaser cipher message by a fixed amount called key, if key is 2 we would
shift every letter of message by two units then message would
Let us assume that plaintext messages use only the 26 capital letters of the alphabet,and that each letter
end up to meaningless combination of lettters then to decrypt it
is first mapped to its correspondingwe position
wouldin the alphabet
shift back every letter backwards according to key
and we would again land on our meaningful message.
So we will represent it in form useful mathematical function by
utilising mod function.
Then a positive integer key value k is chosen that shifts each number k positions to the right . Finally, the function g-1
This is encoding function ----
is applied to translate the resulting this
number back into a letter.
is decoding This produceswill
function----.we the see
final ciphertext
how thischaracter
work byc that correspon
seeing
ds to an original plaintext character p. Informally, we could compute c from p by just shifting over, in a circular fashion, k p
ositions in the list of letters an example.

The encoding function is given by


The decoding process is to find the number for c, shift left k positions then change the resulting digit back into
a character. The decoding function is
Amarjeet
Example
In a Caesar cipher with k = 3,
E encodes to g-1 ((4 + 3 )mod 26) = g-1 (7 mod 26) = g-1 (7) = H
Y encodes to g-1 ((24 + 3) mod 26) = g-1 (27 mod 26) =g-1(1) = B
And for k = 3,
H decodes to g-1 ((7 − 3) mod 26) = g-1(4 mod 26) = g-1(4) = E
B decodes to g-1((1 − 3) mod 26) = g-1(−2 mod 26) = g-1(24) = Y

Here, we can see how modulo is used in encrypting and decrypting caesar cipher.
Hashing as a password
encryption

The user of a computer system typically has to


enter a user ID and password to authenticate him
or her as a legitimate user

The list of user IDs and corresponding passwords


must be stored somewhere in the computer
system, and this information is obviously
sensitive.
Hashing as a password encryption
Why password are not encrypted?

Limitations
Data can be decrypted if you have the right key,
If two users have same passwords,encrypted text would look same.From which it can be concluded that t
hey share same password.
Hashing and Salting Alice's Passwo
Hashing and Salting Bob's
rd
Password
User: Alice User: Bob

Password: farm1990M0O Password: farm1990M0O

Salt: f1nd1ngn3m0
Salt: f1nd1ngd0ry

Salted input: farm1990M0Of1nd1ngn3m0


Salted input: farm1990M0Of1nd1ngd0ry

Hash (SHA-256): 07dbb6e6832da0841dd7


9701200e4b179f1a94a7b3dd26f612817f3c Hash (SHA-256):
03117434 11c150eb6c1b776f390be60a0a5933a2a2f8
c0a0ce766ed92fea5bfd9313c8f6
SHA-256
Algorithm Initialize array of round constants:
(first 32 bits of the fractional parts of the cube roots of the first 64 primes
2..311):
k[0..63] :=
Initialize hash values: 0x428a2f98, 0x71374491, 0xb5c0fbcf, 0xe9b5dba5, 0x3956c25b,
0x59f111f1, 0x923f82a4, 0xab1c5ed5,
(first 32 bits of the fractional 0xd807aa98, 0x12835b01, 0x243185be, 0x550c7dc3, 0x72be5d74,
parts of the square roots of the 0x80deb1fe, 0x9bdc06a7, 0xc19bf174,
first 8 primes 2..19): 0xe49b69c1, 0xefbe4786, 0x0fc19dc6, 0x240ca1cc, 0x2de92c6f,
h0 := 0x6a09e667 0x4a7484aa, 0x5cb0a9dc, 0x76f988da,
0x983e5152, 0xa831c66d, 0xb00327c8, 0xbf597fc7, 0xc6e00bf3,
h1 := 0xbb67ae85 0xd5a79147, 0x06ca6351, 0x14292967,
h2 := 0x3c6ef372 0x27b70a85, 0x2e1b2138, 0x4d2c6dfc, 0x53380d13, 0x650a7354,
h3 := 0xa54ff53a 0x766a0abb, 0x81c2c92e, 0x92722c85,
0xa2bfe8a1, 0xa81a664b, 0xc24b8b70, 0xc76c51a3, 0xd192e819,
h4 := 0x510e527f 0xd6990624, 0xf40e3585, 0x106aa070,
h5 := 0x9b05688c 0x19a4c116, 0x1e376c08, 0x2748774c, 0x34b0bcb5, 0x391c0cb3,
h6 := 0x1f83d9ab 0x4ed8aa4a, 0x5b9cca4f, 0x682e6ff3,
0x748f82ee, 0x78a5636f, 0x84c87814, 0x8cc70208, 0x90befffa,
h7 := 0x5be0cd19
0xa4506ceb, 0xbef9a3f7, 0xc67178f2
Pre-processing (Padding):
begin with the original message of length L bits
append a single '1' bit
append '0' bits, making the total post-processed length a multiple of 512 bits

//we have created 16 words from 512 bits with each word having 32-bit
Extend the first 16 words into the remaining 48 words w[16..63] of the message schedule array:
for i from 16 to 63
s0 := (w[i-15] rightrotate 7) xor (w[i-15] rightrotate 18) xor (w[i-15] rightshift 3)
s1 := (w[i- 2] rightrotate 17) xor (w[i- 2] rightrotate 19) xor (w[i- 2] rightshift 10)
w[i] := w[i-16] + s0 + w[i-7] + s1
Initialize working variables to current hash value: Compression function main loop:
for i from 0 to 63
a := h0
S1 := (e rightrotate 6) xor (e rightrotate
b := h1 11) xor (e rightrotate 25)
c := h2 ch := (e and f) xor ((not e) and g)
d := h3
temp1 := h + S1 + ch + k[i] + w[i]
S0 := (a rightrotate 2) xor (a rightrotate
e := h4 13) xor (a rightrotate 22)
f := h5 maj := (a and b) xor (a and c) xor (b
g := h6 and c)
temp2 := S0 + maj
h := h7

h := g
g := f
f := e
e := d + temp1
d := c
c := b
b := a
a := temp1 + temp2
Add the compressed chunk to the current hash value:
h0 := h0 + a
h1 := h1 + b
h2 := h2 + c
h3 := h3 + d
h4 := h4 + e
h5 := h5 + f
h6 := h6 + g
h7 := h7 + h

Produce the final hash value


hashed password := hash := h0 append h1 append h2 append h3 append h4 append h5
append h6 append h7
Conclusion
Nowadays,Most password encryption
schemes append some sort of timestamp to
a password when the password is first
created, and (password + timestamp) is
encrypted and the result is hashed.
Adding a additional layer of security,thus
making it unbreakable.
As the technology is evolving, hackers are
becoming stronger so it is in constant need
to make the system more stonger
THANKS

You might also like