Coder Social home page Coder Social logo

4bit-sbox-lat-ddt's Introduction

4bit-sbox-LAT-DDT

Homework

140201113

Language: python3 on pyCharm
Requirements: sympy
to install: pip install sympy

Code's logic: For both LAT & DDT there are similarities in the code: 1 big global variable holding the necessary information. Next on get_values, check_value, print_table, traverse, print_DDT/print_LAT functions the input from the user is taken and shown in tables. The difference is on calc_value function:

For LAT:

  1. get the inputmask and outputmask from traverse function.
  2. get the sboxinput and sboxoutput values
  3. then take single bits from the both the inputs and outputs
  4. xor and compare them
  5. if the result is true increment the total variable
  6. finally return total - 2**(n-1) [2**(4-1) = 8]
  7. [2**(n-1) - 2**(n/2 - 1) / 2**(n-1) - |max|] returns the percentage of nlm

For DDT:

  1. get a and b from traverse function
  2. then get the value for S(x ^ a) as variable x.
  3. finally xOR it with S(X) which is sboxo
  4. if the S(X) xOR S(X xOR a) == b returns true increment total
  5. return total

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.