Giter Site home page Giter Site logo

encryption's Introduction

Encryption

5种加密算法:Vigenere,DES,RSA,MD5,DSS

Vigenere 密码算法

A、       选定一个英文单词,将其中单词对应为1-26的数字数组作为密匙

B、        将明文利用ASCII码转换为数字,并将密匙数字与其对应相加,循环,对26取余。

C、       将所得数字密文转换为字符,即得密文。

 

 DES 对称密码算法

A.    输入64位明文数据,并进行初始置换IP

B.    在初始置换IP后,明文数据再被分为左右两部分,每部分32位,以L0R0表示;

C.    在秘钥的控制下,经过16轮运算(f)

D.    16轮后,左、右两部分交换,并连接再一起,再进行逆置换;

E.     输出64位密文。

RSA 密码算法

随机选择两个不相等的质数pq

计算pq的乘积n

计算n的欧拉函数φ(n)

随机选择一个整数a,条件是1< e < φ(n),且eφ(n) 互质。

计算a对于φ(n)的模反元素b

na封装成公钥,nb封装成私钥。

MD5 密码算法

A、填充:如果输入信息的长度(bit)512求余的结果不等于448,就需要填充使得对512求余的结果等于448。填充的方法是填充一个1n0。填充完后,信息的长度就为N*512+448(bit)

B、 记录信息长度:用64位来存储填充前信息长度。这64位加在第一步结果的后面,这样信息长度就变为N*512+448+64=(N+1)*512位。

C、装入标准的幻数(四个整数):标准的幻数(物理顺序)是(A=(01234567)16B=(89ABCDEF)16C=(FEDCBA98)16D=(76543210)16

四轮循环运算:循环的次数是分组的个数(N+1 
1
)将每一512字节细分成16个小组,每个小组64位(8个字节)
2
)先认识四个线性函数(&是与,|是或,~是非,^是异或)

  F(X,Y,Z)=(X&Y)|((~X)&Z)
  G(X,Y,Z)=(X&Z)|(Y&(~Z))
  H(X,Y,Z)=X^Y^Z
  I(X,Y,Z)=Y^(X|(~Z))

DSS 签名算法

DSS 的签名过程如下:

 r=(gkmod p)mod q

 s=[k-1(H(M)+xr)] mod q

则形成了对信息 M 的数字签名(r,s),数字签名和信息 M 一同发送给接收方。接收方接收到信息 M’和数字签名(r’,s’)后,对数字签名的验证过程如下:

 w=(s’)-1 mod q

u1=[H(M’)w] mod q,

u2=( r’)wmod q

v=[(gu1 yu2)mod p]mod q

如果 v= r’,则说明信息确实来自发送方。

encryption's People

Contributors

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