Git Product home page Git Product logo

elgamal's Introduction

BTW

  • 以前帮别人做毕业论文的,偶然看到代码,发现对消息m的支持不够好(只能支持数字和字母),现在改成能用,不过消息m的长度也增加了许多

算法

  • 密钥对产生办法:首先选择一个素数p和两个随机数g 、x (g、 x < p ),计算 y ≡ g^x( mod p ) ,已知y,求解x是非常困难的事情(离散对数求解难题),则其公钥为 y, g 和p ,私钥是x ,g和p可由一组用户共享。
  • ElGamal用于数字签名。被签信息为M,首先选择一个随机数k , k与 p - 1互素,计算:
a ≡ g^k ( mod p )
  • 再用扩展 Euclidean 算法对下面方程求解b:
M ≡ xa + kb ( mod p - 1 )
  • 签名就是( a, b )。随机数k须丢弃。
  • 验证时要验证下式:
y^a * a^b ( mod p ) ≡ g^M ( mod p )
  • 同时一定要检验是否满足1<= a < p。否则签名容易伪造。
  • ElGamal用于加密。被加密信息为M,首先选择一个随机数k,k与 p - 1互质,计算
a ≡ g^k ( mod p )
b ≡ y^k M ( mod p )
  • ( a, b )为密文,是明文的两倍长。解密时计算
M ≡ b / a^x ( mod p )
  • ElGamal签名的安全性依赖于乘法群(IFp)* 上的离散对数计算。素数p必须足够大,且p-1至少包含一个大素数

elgamal's People

Stargazers

 avatar  avatar

Watchers

 avatar  avatar

Forkers

katezytchuk

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.