Skip to content

This repository contains the project done during the 4th edition of 42 Labs São Paulo between January 09th, 2023 and January 15th, 2023.

License

Notifications You must be signed in to change notification settings

ygor-sena/42-labs-challenge-v4

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Hi, welcome to this page! 👋🏻

⚠️ Caso você não entenda inglês, leia a versão deste README em português neste link. ⚠️

Initial thoughts on Labs 4th Edition

This README.md succinctly describes the challenge for the 4th edition of the Labs. In case you want to read the complete subject of the challenge and/or read in detail about the implementation of the project, check the corresponding GitHub Wiki in the Wiki tab or directly in this link: (https://github.com/ygor-sena/42-labs-challenge-v4/wiki)

About the project

The Labs 4th Edition took place between January 09th, 2023 and January 15th, 2023. The project of this edition consists of the implementation of two programs, encoder and decoder, with communication via shared memory to compress and decompress a file. The first program, encoder, receives a text file to be compressed; the second, decoder, will return to the first a series of data about the result of the decompression from the initial information provided by the encoder. The project must be programmed in C and no library outside the standard C ANSI is allowed.

Compiling, using and running the project

1) Copy this repository to your local workstation

git clone git@github.com:42sp/42labs-selection-process-v4-ygor-sena.git

2) Compile the project with Makefile

make

3) Open two instances of the command terminal and, in one of them, launch the decoder program

./decoder

If you want to run the program looking for memory leaks, just start it as follows:

valgrind --leak-check=full --show-leak-kinds=all ./decoder

4) In the other terminal, launch the encoder program

./encoder example.txt

The encoder will read the example.txt file, compress it and send the information for decompression to the decoder. While receiving and processing the information, the decoder will display the message Waiting for encoder data... on the terminal's standard output. After decompressing the file, the decoder sends information about the compilation result back to the encoder which displays it at the command prompt.

5) Usage example

As an example of the aforementioned program output results, if we create a test file using the command...

  yes "The best lorem ipsum in the world." | head -c 30 > 30BYTES.txt

... the output displayed by encoder will look something like this:

Unzipped text is: O melhor lorem ipsum do mundis
File size in bytes: 31
Total bytes compressed: 16
Decompression time is: 0.003033

Tools used

Project planning and development tools were used during the challenge, such as Jira Software and branch workflow on the present GitHub, Effie for compiling references, annotating and visualizing ideas. For more details, consult the corresponding section in the GitHub Wiki of the project.

Concepts learned during the process

  • Greedy algorithms
  • Compression algorithms
  • Types of encryption
  • Trees and linked lists
  • IPC through shared memory
  • IPC through semaphores
  • bitwise operations
  • Reading and writing files
  • Type conversion in C
  • Workflow organization
  • Planning of development stages
  • Project documentation

Implemented features

Mandatory:

  • ✅ Full implementation of Huffman algorithm
  • ✅ Compression and decompression using the above-mentioned algorithm
  • ✅ Communication via shared memory
  • ✅ Display of decoder information by encoder
  • ✅ Basic README.md

Bonus:

  • ✅ Use of external tools for planning in the development stages
  • ❌ Compression of multiple binary files.
  • ❌ Compressed data encryption, using password provided by the user.
  • ❌ Compressed file integrity check.
  • ❌ Option to choose another compression algorithm to be used.

Project References

Check the corresponding section in the project's GitHub Wiki.

About

This repository contains the project done during the 4th edition of 42 Labs São Paulo between January 09th, 2023 and January 15th, 2023.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published