Git Product home page Git Product logo

crypto's Introduction

Cryptography

Read - https://cryptohack.gitbook.io/cryptobook/fundamentals/

Read - https://bitsdeep.com/posts/attacking-rsa-for-fun-and-ctf-points-part-2/

Euclidean Alogrithm - https://www.freecodecamp.org/news/euclidian-gcd-algorithm-greatest-common-divisor/

The Extended Euclidean Algorithm - http://www-math.ucdenver.edu/~wcherowi/courses/m5410/exeucalg.html

Phi Exploration - https://www.khanacademy.org/computing/computer-science/cryptography/modern-crypt/pi/euler-totient-exploration

Factoring - http://factordb.com/ , https://www.alpertron.com.ar/ECM.HTM

>>> from sympy import * >>> factorint(value)

  • Use the above module for factoring!

https://github.com/ryosan-470/factordb-python

Read - https://github.com/ashutosh1206/Crypton

Read - https://ctf-wiki.org/crypto/asymmetric/rsa/rsa_theory/

Read - https://cryptobook.nakov.com/digital-signatures/rsa-signatures

Read - http://secgroup.dais.unive.it/wp-content/uploads/2012/11/Practical-Padding-Oracle-Attacks-on-RSA.html

Notes:

part1: Key Generation

Select p,q p and q are prime numbers; p!=q

Calculate n n = p * q

Calculate phi(ϕ) ϕ = ( p - 1 ) * ( q - 1 )

Select integer e GCD ( ϕ(n) , e ) = 1; 1 < e < ϕ(n)

Calculate d d = inverse(e) % ϕ(n)

Public Key (Pk) {e,n}

Private Key (Pr) {d,n}

Part2: Encryption

Plain Text (M) M < n

Cipher Text (C) C = pow( M , e) % n

Part3: Decryption

Cipher Text (C) C

Plain Text (M) M = pow(C , d) % n

Sage commands:

from sage.rings.finite_rings.integer_mod import square_root_mod_prime

print(square_root_mod_prime(Mod(a,p),p)) = r^2

r^2 = a mod p

  • To find mod square root

Formula

  • Consider single prime!

phi(p^k) = (p-1)*(p^k-1)

phi(p^3) = (p-1)*(p^2)

  • Finding phi from e,n,d

k=(e*d-1)//n

phi=(e*d-1)//(k+1)

crypto's People

Contributors

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