Code Monkey home page Code Monkey logo

rolling_code's Introduction

Remote Sender and Receiver

This code implements a remote sender and receiver system using Linear Feedback Shift Registers (LFSRs) and Advanced Encryption Standard (AES) encryption. The system generates rolling codes, tokens, and verifies the authenticity of messages.

Components

  • RemoteSender: Initializes an LFSR with a given serial number, taps, initial state, and number of bits. Generates rolling code values and tokens.
  • Receiver: Initializes an LFSR with the same parameters as the sender. Generates rolling code windows and verifies the authenticity of received messages.

Usage

  1. Define the master key (a 16-byte hexadecimal string). This key is used to generate the sender key.
  2. Create a receiver object using the master key, taps, initial state, and number of bits.
  3. Generate the initial rolling code window for the receiver.
  4. Use the receiver's serial number to generate the sender key using the KDF (Key Derivation Function).
  5. Create a sender object using the receiver's serial number, sender key, taps, initial state, and number of bits.
  6. Generate the initial rolling code window for the sender.
  7. Extract the raw token from the sender's rolling code window and encrypt it using AES to generate the token.
  8. Send the message (serial number + token) to the receiver.

Verification

  1. The receiver generates its own token using the encrypted message and the master key.
  2. Compare the receiver's token with the original token sent by the sender. If they match, the message is verified as authentic.

Notes

  • This code assumes a valid pairing between the remote sender and the receiver.
  • The sender and receiver must share the same taps, initial state, and number of bits for the LFSR.
  • The master key should be kept secret in real-life situations.

License

This code is licensed under the MIT License.

rolling_code's People

Contributors

traoremorike 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.