项目作者: yzoz

项目描述 :
Python public-key encryption / decryption (simple RSA implementation example)
高级语言: Python
项目地址: git://github.com/yzoz/python-asymmetric-cryptography.git
创建时间: 2019-08-10T16:57:24Z
项目社区:https://github.com/yzoz/python-asymmetric-cryptography

开源协议:

下载


Python public-key cryptography example

Simpliest as possible implementation of asymmetric encryption with Public-key in Python. Something like RSA, but easier and clearer.

Python’s built-in math functions are not used for clarity.



(:

Except for basic operators:

Floor Division

Modulo Division

Exponent

Bitwise Operators

):

Implemented functions:


  • Binary search to find floor square root of positive integer

  • Modular exponentiation by repeated squaring for fast computation of large positive integer powers of a number

  • Euclidean algorithm for computing the greatest common divisor (GCD) of two numbers

  • Extended Euclidean algorithm that computes coefficients of Bézout’s identity to find Private-key exponent (modular multiplicative inverse of Public-key exponent)

  • Trial division (easiest to understand of the integer factorization algorithms) to determine whether a number is a prime

  • Fermat primality test to check it exponentially faster way

Large messages are splitts into blocks.