Git Product home page Git Product logo

caesarlkm's Introduction

CaesarLKM

Linux Kernel Module for Caesar Cipher

Table of Contents

Introduction

Caesar cipher is a basic substitution cipher where each character in the plaintext is shifted by a certain number of positions in the alphabet. In this driver, we use the English alphabet including spaces, totaling 53 characters.

The kernel module allows dynamic encryption and decryption of text accessed through the /dev/encrypt and /dev/decrypt device files.

Prerequisites

  • Linux operating system (tested on Ubuntu 24.04 LTS)
  • Basic knowledge of using kernel modules and device files in Linux

Installation

  1. Clone the repository:
    git clone https://github.com/amaldoror/CaesarLKM
    cd CaesarLKM
    
  2. Install libraries:
    sudo apt-get update
    apt-cache search linux-headers-$(uname -r)
    sudo apt-get install linux-headers-[VERSION]
    

Makefile

  1. Compile the Kernel Module:
    make
    
  2. Clean up:
    make clean
    
  3. Load the Kernel Module:
    make load
    
  4. Unload the Kernel Module:
    make unload
    
  5. View Kernel Logs:
    make log
    
  6. Help:
    make help
    

Usage

To use the module, it has to be compiled and loaded.
Once the module is loaded, the device files /dev/encrypt and /dev/decrypt are available.

  1. Encryption:
    echo "Hello hello!" > /dev/encrypt
    cat /dev/encrypt  # Outputs "Khoor khoor!"
    
  2. Decryption:
    echo "Khoor khoor!" > /dev/decrypt
    cat /dev/decrypt  # Outputs "Hello hello!"
    

Module Parameters

The module supports the translate_shift parameter to specify the number of characters to shift for encryption.
By default, this is set to 3.

Example of loading the module with a different shift value: ```bash sudo insmod caesar_cipher.ko translate_shift=5

File Operations

The module implements the following file operations for the device files:

  • open: Opens the device file and locks the corresponding mutex.
  • release: Closes the device file and unlocks the mutex.
  • read: Reads from the device file and copies data to user space.
  • write: Writes to the device file and performs Caesar cipher encryption or decryption.

Security Considerations

The driver uses mutexes to ensure that only one process can access the device files at a time.
It's recommended to encrypt only ASCII characters that are part of the defined alphabet (ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz).
Non-included characters are passed through unchanged.

License

This project is licensed under the GNU General Public License (GPL) v2. For more details, see the LICENSE file.

Authors

Adrian Morgenthal www.github.com/amaldoror

caesarlkm's People

Contributors

amaldoror avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.