Cambodia Academy of Digital Technology Telecommunication and Networking
Name: Yim Chansreypin ID: 100073
Lecture: Socheat Chea (Ph.D)
Data compression and Cryptography
Assignment 01
Classwork: Give a real example of each type of coding theory including Source Coding,
Channel Coding, Cryptographic Coding, and Line Coding. What is bit? How does bit represent
data? How many bits in a byte?
An: + Source coding: reduces the size of data by removing redundancy, making it more
efficient for storage or transmission.
Real Example: ZIP – File Compression (ZIP Archive Format)
• Compresses one or more files or folders into a single .zip file to save space and make
transfers easier. ZIP uses lossless compression, meaning the original data is perfectly
preserved after decompression.
Example: A folder containing 100 MB of documents may compress to 40 MB in ZIP
format.
+ Channel Coding: Channel coding adds extra bits to data to detect and correct errors
during transmission over noisy channels.
Real Example: Hamming Codes
• Computer memory systems, satellite communication, and embedded systems where
simple error correction is sufficient. Type: Linear Block Code.
• Detects and corrects single-bit errors; can detect (but not correct) two-bit errors. It adds
parity bits to a block of data to form a codeword.
• The parity bits are placed at specific positions (powers of 2) and calculated to cover
multiple bit positions. When a codeword is received, the parity bits are checked to
compute the syndrome, which identifies the error position.
+ Cryptographic Coding: transforms readable data into unreadable form (encryption) to
ensure privacy, security, and authenticity.
Real Example: DES (Data Encryption Standard)
• DES are developed by IBM in the 1970s. DES uses a single key for both encryption and
decryption. It encrypts 64-bit blocks of data using a 56-bit key. It performs 16 rounds of
substitution and permutation operations on the data.
1
Cambodia Academy of Digital Technology Telecommunication and Networking
+ Line Coding: The process of converting binary data (0s and 1s) into a signal for
transmission over physical media like cables.
Real Example: NRZ (Non-Return-to-Zero)
• A simple unipolar line coding where '1' is a positive voltage and '0' is a negative voltage.
The signal stays constant during each bit and does not return to zero. It's easy to
implement but has poor clock recovery in long runs of the same bit. Best for short-
distance, high-speed links.
+ What is bit? >> A bit (short for binary digit) is the smallest unit of data in a computer.
A bit can represent one of two values: 0 or 1.
+ How does bit represent data? >> Computers use a binary system, where data is
represented as a sequence of bits (0s and 1s). Bits are combined to form larger units of
data, such as bytes.
+ How Many Bits in a Byte? >> A byte is typically composed of eight bits. (Standard)
Classwork:
1.Give real example of Lossless data compression and Lossy data compression? How does
they work?
An: + For Lossless data compression
_ ZIP Files : Lossless compression rebuilds and restores file data to its original state after
decompression. For instance, when the file size of an image is condensed, its quality stays
unchanged. Without data loss, one may resize the file to its original state. This kind of
compression is often referred to as reversible compression.
+ For Lossy data compression
_ ZIP Files : In lossy compression, data is stripped from a file and is not returned to its original
state upon decompression. Specifically, data is erased irreversibly, which is why this technique is
also called irreversible compression. Such data loss is often imperceptible. Nonetheless, the
longer a document or file has been compressed, the more deterioration happens, and the loss
becomes evident over time.
2. When do we need to use Lossless data compression and when do we need to use Lossy data
compression?
An: + We need to use Lossless data compression
• You need to preserve the original quality of the data (e.g., text files, code files, important
documents, medical images).
• The data must remain identical after decompression.
2
Cambodia Academy of Digital Technology Telecommunication and Networking
+ We need to use Lossy data compression
• You can afford some loss of quality to achieve a significant reduction in file size (e.g.,
images, audio, videos).
• The focus is on reducing the file size for streaming or storage purposes, and minor quality
loss is acceptable (e.g., web images, music streaming).
3. Is the process of sending image into chat of Facebook Lossless or Lossy compression?
An: When you send an image in a chat on Facebook, it uses lossy compression.
4. Investigate what compression software is available on your computer system. For example,
do you use winzip or gzip, etc.?
An: Compression software : WinZip, GZip are often available on systems for file compression
and decompression. These tools can handle both lossless (e.g., ZIP, TAR) and some lossy formats
(e.g., for images or audio files).
5. Suppose the size of myfile.gz is 20 KB while the original file myfile is 40KB. Compute the
compression ratio, compression factor and saving percentage.
An: We have myfile.gz = 20 K and original file myfile = 40KB
Size after Compression 20
Compression Ratio = = = 0.5
𝑆𝑖𝑧𝑒 𝑏𝑒𝑓𝑜𝑟𝑒 𝐶𝑜𝑚𝑝𝑟𝑒𝑠𝑠𝑖𝑜𝑛 40
Size before Compression 40
Compression Factor = = =2
𝑆𝑖𝑧𝑒 𝐴𝑓𝑡𝑒𝑟 𝐶𝑜𝑚𝑝𝑟𝑒𝑠𝑠𝑖𝑜𝑛 20
Size before Compression−Size after Compression 40−20
Saving Percentage = %= × 100 = 50%
𝑆𝑖𝑧𝑒 𝑏𝑒𝑓𝑜𝑟𝑒 𝐶𝑜𝑚𝑝𝑟𝑒𝑠𝑠𝑖𝑜𝑛 40
Classwork:
Give another application or example in cryptographic coding? What is the advantages of
cryptographic coding? What is difference between Line coding and Digital modulation?
An: + Another application or example in cryptographic coding
• Online Banking Transactions
When you log in to your online banking account or make a payment, SSL/TLS encryption (a
form of cryptographic coding) is used to secure the data transfer between your browser and the
bank’s server. This ensures that sensitive information like login credentials, account numbers,
and payment details cannot be intercepted or read by hackers.
+ Advantages of Cryptographic Coding
Cryptography is the practice of developing and using coded algorithms to protect and obscure
transmitted information so that it may only be read by those with the permission and ability to
3
Cambodia Academy of Digital Technology Telecommunication and Networking
decrypt it. And we have Data Confidentiality, Data Integrity, Authentication, Non-repudiation,
Secure Communication.
+ What is difference between Line coding and Digital modulation?
_ Line coding
• Converts digital data into a digital signal suitable for baseband transmission.
• Doesn't involve a carrier wave.
• Examples include NRZ, Manchester coding, and HDB3.
• Focuses on properties like bandwidth efficiency, error detection, and synchronization.
_ Digital Modulation
• Encodes digital data onto a carrier wave for transmission over a passband channel.
• Examples include ASK, FSK, PSK, and QAM.
• Focuses on bandwidth efficiency, robustness to channel impairments, and signal-to-noise
ratio.
• Can use amplitude, frequency, or phase of the carrier wave to represent data.
Explain about formula
+ For Compression Ratio
Size after Compression
Compression Ratio =
𝑆𝑖𝑧𝑒 𝑏𝑒𝑓𝑜𝑟𝑒 𝐶𝑜𝑚𝑝𝑟𝑒𝑠𝑠𝑖𝑜𝑛
The Compression Ratio measures how much smaller the compressed file is relative to the
original file.
• If after compression the file becomes smaller, you want a number less than 1 (e.g., 0.3)
indicating the file is 30% of its original size.
• If after compression the file doesn’t shrink (bad compression), the ratio will be close to 1.
+ For Compression factor
Size before Compression
Compression Factor =
𝑆𝑖𝑧𝑒 𝐴𝑓𝑡𝑒𝑟 𝐶𝑜𝑚𝑝𝑟𝑒𝑠𝑠𝑖𝑜𝑛
The Compression Factor is just the reverse: it tells you how many times bigger the original
file was compared to the compressed file.
• It shows how much you compressed by showing the multiple.
• You want a large number showing how efficient the compression was.