20-02-2023
DATA COMPRESSION AND
ENCRYPTION
DCE//SEM VI//EXTC//Dr. Vishakha Kelkar 1
Syllabus
DCE//SEM VI//EXTC//Dr. Vishakha Kelkar 2
1
20-02-2023
DCE//SEM VI//EXTC//Dr. Vishakha Kelkar 3
DJ19ECEC6012 On completion of the course, learner will be able to: Blooms
and Level
DJ19ECEL6012
CO1 Describe various lossy and lossless techniques. Understand
Apply various compression techniques for compression of text,
image, audio and video.
CO2 Apply
Describe the range of different cryptosystems and various
CO3 network security related protocol. Understand
Analyze how the basic design criteria for various
cryptosystems like confusion, diffusion and number theory are
CO4 used in cryptographic techniques. Analyze
DCE//SEM VI//EXTC//Dr. Vishakha Kelkar 4
2
20-02-2023
WHAT IS DATA COMPRESSION?
• Data compression is science used to reduce the size of data being stored
or transmitted.
WHAT IS CYPTOGRAPHY?
• cryptography is the study of
secret (crypto-) writing (-graphy)
DCE//SEM VI//EXTC//Dr. Vishakha Kelkar
5
Bank Bank
Katie’s Bank CD Store
Merchant’s Bank
Internet Payment Network
Katie’s
order Online
CD Store
Web Server
ISP
CD
Order printed at Warehouse
CD warehouse
Katie sends
CD arrives 2-3 days
Order Form after order is received 6
3
20-02-2023
Internet Backbone
E
Breaking into
D store database
Online CD Store
Web Server
B
ISP Sniffer at ISP
C
Sniffer on CD
Warehouse
Internet backbone
A
Tapping line
Katie 7
Security Goals
Confiden
tiality
Integri Authen
ty tication
DCE//SEM VI//EXTC//Dr. Vishakha Kelkar 8
4
20-02-2023
Terminology
cryptography
the art or science encompassing the principles and methods of
transforming an intelligible message into one that is
unintelligible, and then retransforming that message back to
its original form
plaintext
the original intelligible message
ciphertext
the transformed message
cipher
an algorithm for transforming an intelligible message into one
that is unintelligible by transposition and/or substitution
methods
key
some critical information used by the cipher, known only to the
sender & receiver
DCE//SEM VI//EXTC//Dr. Vishakha Kelkar 9
DCE//SEM VI//EXTC//Dr. Vishakha Kelkar 10
5
20-02-2023
Introduction to Data
Compression
Why Data Compression?
Decrease storage requirements
Effective use of communication
bandwidth
Multimedia data on information
superhighway
BECAUSE IT IS POSSIBLE!
DCE//SEM VI//EXTC//Dr. Vishakha Kelkar 12
6
20-02-2023
Approximate Bit Rates for
Uncompressed Sources (I)
Telephony 8000 samples/sec X 12 bit/sample
(Bandwidth=3.4kHz) = 96 kb/sec
---------------------------------------------------------------------------
Wideband Speech 16,000 s/s X 14 b/s = 224 kb/sec
(Tele.audio bw~7 kHz)
---------------------------------------------------------------------------
Audio 44,100 s/s X 16 b/s X 2 channels
(Bandwidth~ 20kHz) = 1.41 Mb/sec
---------------------------------------------------------------------------
Images 512x512 pixelsX24 bits/pixel=6.3 Mb/image
----------------------------------------------------------------------------
DCE//SEM VI//EXTC//Dr. Vishakha Kelkar 13
Approximate Bit Rates for
Uncompressed Sources (II)
Video
640x480 color pixel X 24 bits/pixel X 30 images/sec=221Mb/s
Gap between available bandwidth and the required
bandwidth can be filled using compression!
DCE//SEM VI//EXTC//Dr. Vishakha Kelkar 14
7
20-02-2023
Compression and
Reconstruction
Source X
Reconstructed Y
Compressed Xc
Compression Reconstruction
Lossless: Reconstructed is identical to Source.X=Y
Lossy: Reconstructed is different from Source.X NOT =Y
Usually more compression with lossy, but give up exactness.
It is also possible to classify the algo. based on symmetry.
Ex.--Video compression.
DCE//SEM VI//EXTC//Dr. Vishakha Kelkar 15
Lossless compression
techniques
Huffman coding Text compression
Image compression
Lempel-Ziv coding Facsimile
Run-length coding Audio compression
Arithmetic coding Computer modems
DCE//SEM VI//EXTC//Dr. Vishakha Kelkar 16
8
20-02-2023
Lossy Compression
Storing transmitting speech
Video
How much lossy depends on application &
human perception
----Telephony,wideband audio,CD
DCE//SEM VI//EXTC//Dr. Vishakha Kelkar 17
Key Ideas For Compression
Remove the redundancy in data –
image,video.
Statistical structure –morse code
Physical structure of source-vocoders.
User application-perceptual ability.
Allow certain amount of loss in quality.
DCE//SEM VI//EXTC//Dr. Vishakha Kelkar 18
9
20-02-2023
Morse Code (1835)
DCE//SEM VI//EXTC//Dr. Vishakha Kelkar 19
Lossy compression
If we accept some distortion, we can achieve much
higher compression ratio.
DCE//SEM VI//EXTC//Dr. Vishakha Kelkar 20
10
20-02-2023
Lossy Compression System
Lossy CS, which aim at obtaining the best
possible fidelity for a given bit-rate (or
minimizing the bit-rate to achieve a given
fidelity measure).
Lossless CS which aim at minimizing the
bit rate of the compressed output without
any distortion in the data. The
decompressed bit-stream is identical to
original bit-stream.
DCE//SEM VI//EXTC//Dr. Vishakha Kelkar 21
Measures Of Performance
Relative complexity of the algo.
How fast the algo. performs
How much loss in reconstruction
Compression ration
Bit Rate
MSE/PSNR
Fidelity
DCE//SEM VI//EXTC//Dr. Vishakha Kelkar 22
11
20-02-2023
Modeling and Coding
Model Model
Probability Probability
Probability Probability
Distribution Distribution
Estimates Estimates
Transmission System Original Source
Source Encoder Decoder Messages
Messages Compressed
Bit Stream
DCE//SEM VI//EXTC//Dr. Vishakha Kelkar 23
Example 1
9 11 11 11 14 13 15 17 16 17 20 21
We could represent each number using 5 bits (could use 4 bits).
Need 12*5 = 60 bits (or 12*4 = 48 bits) for entire message.
20 y = 1.0175x + 7.9697
15
10
0
0 2 4 6 8 10 12
DCE//SEM VI//EXTC//Dr. Vishakha Kelkar 24
12
20-02-2023
Example 1, cont.
Model: xn = n + 8
Source: 9 11 11 11 14 13 15 17 16 17 20 21
Model: 9 10 11 12 13 14 15 16 17 18 19 20
Residual: 0 1 0 -1 1 -1 0 1 -1 -1 1 1
Only need to transmit the model parameters and residuals.
Residuals can be encoded using 2 bits each 12*2 = 24 bits.
Savings as long as model parameters encoded in less than
60-24=36 bits (or 48-24 = 24 bits)
DCE//SEM VI//EXTC//Dr. Vishakha Kelkar 25
Example 2
27 28 29 28 26 27 29 28 30 32 34 36 38
We could represent each number using 6 bits (could use 4 bits).
Need 13*6 = 78 bits (or 13*4 = 52 bits) for entire message.
40
30
20
10
0
0 5 10 15
DCE//SEM VI//EXTC//Dr. Vishakha Kelkar 26
13
20-02-2023
Example 2, cont.
Transmit first value, then successive differences.
Source: 27 28 29 28 26 27 29 28 30 32 34 36 38
Transmit: 27 1 1 -1 -2 1 2 -1 2 2 2 2 2
6 bits for first number, then 3 bits for each difference value.
6 + 12*3 = 6+36 = 42 bits (as compared to 78 bits) .
Encoder and decoder must also know the model being used!
DCE//SEM VI//EXTC//Dr. Vishakha Kelkar 27
Run-length Encoding
Example: two character alphabet {a,b}
aaaaaaaaaaaaabbbbbbbbaaaaaaaaaaabbbbbbbbbbbbbbbaaa
Uncompressed message requires 50*1 = 50 bits
Run-length encoding (arbitrarily start with a)
13 8 11 15 3
Use 8 bits for each number 8*5 = 40 bits.
Note: may increase number of bits required.
All sources can not have same compression algorithms
DCE//SEM VI//EXTC//Dr. Vishakha Kelkar 28
14
20-02-2023
The Book with no ‘e’
E.V. Wright ‘Gadsby’ published in 1939
The first sentence:
“If Youth, throughout all history, had had a champion to stand up for
it; to show a doubting world that a child can think; and, possibly, do it
practically; you wouldn’t constantly run across folks today who claim
that ‘a child don’t know anything’…
A static model will perform poorly as far as data compression is
concerned.
DCE//SEM VI//EXTC//Dr. Vishakha Kelkar 29
Entropy of English
Aoccdrnig to a rscheearch at an Elingsh uinervtisy, it
deosn't mttaer in waht oredr the ltteers in a wrod are, the
olny iprmoetnt tihng is that frist and lsat ltteer is at the
rghit pclae. The rset can be a toatl mses and you can
sitll raed it wouthit a porbelm. Tihs is bcuseae we do not
raed ervey lteter by itslef but the wrod as a wlohe.
30
15
20-02-2023
REFERENCES
Introduction To Data Compression
By Khalid Sayood
Data Compression Complete Reference
By David Salomon
Network Security
By William Stallings
Cryptography and Network Security
By Forouzan
DCE//SEM VI//EXTC//Dr. Vishakha Kelkar 31
16