怎么禁用MD5和96位MAC算法在位

目前主要关注搜索引擎,P2P,Linux下开发,算法与数据结构领域
md5算法描述
http://www.ietf.org/rfc/rfc1321.txt
3. MD5 Algorithm Description
We begin by supposing that we have a b-bit message as input, and that
we wish to find its message digest. Here b is an arbitrary
b may be zero, it need not be a multiple of
eight, and it may be arbitrarily large. We imagine the bits of the
message written down as follows:
m_0 m_1 ... m_{b-1}
The following five steps are performed to compute the message digest
of the message.
3.1 Step 1. Append Padding Bits
The message is "padded" (extended) so that its length (in bits) is
congruent to 448, modulo 512. That is, the message is extended so
that it is just 64 bits shy of being a multiple of 512 bits long.
Padding is always performed, even if the length of the message is
already congruent to 448, modulo 512.
Padding is performed as follows: a single "1" bit is appended to the
message, and then "0" bits are appended so that the length in bits of
the padded message becomes congruent to 448, modulo 512. In all, at
least one bit and at most 512 bits are appended.
3.2 Step 2. Append Length
A 64-bit representation of b (the length of the message before the
padding bits were added) is appended to the result of the previous
step. In the unlikely event that b is greater than 2^64, then only
the low-order 64 bits of b are used. (These bits are appended as two
32-bit words and appended low-order word first in accordance with the
previous conventions.)
At this point the resulting message (after padding with bits and with
b) has a length that is an exact multiple of 512 bits. Equivalently,
this message has a length that is an exact multiple of 16 (32-bit)
words. Let M[0 ... N-1] denote the words of the resulting message,
where N is a multiple of 16.
3.3 Step 3. Initialize MD Buffer
A four-word buffer (A,B,C,D) is used to compute the message digest.
Here each of A, B, C, D is a 32-bit register. These registers are
initialized to the following values in hexadecimal, low-order bytes
word A: 01 23 45 67
word B: 89 ab cd ef
word C: fe dc ba 98
word D: 76 54 32 10
3.4 Step 4. Process Message in 16-Word Blocks
We first define four auxiliary functions that each take as input
three 32-bit words and produce as output one 32-bit word.
F(X,Y,Z) = XY v not(X) Z
G(X,Y,Z) = XZ v Y not(Z)
H(X,Y,Z) = X xor Y xor Z
I(X,Y,Z) = Y xor (X v not(Z))
In each bit position F acts as a conditional: if X then Y else Z.
The function F could have been defined using + instead of v since XY
and not(X)Z will never have 1's in the same bit position.) It is
interesting to note that if the bits of X, Y, and Z are independent
and unbiased, the each bit of F(X,Y,Z) will be independent and
The functions G, H, and I are similar to the function F, in that they
act in "bitwise parallel" to produce their output from the bits of X,
Y, and Z, in such a manner that if the corresponding bits of X, Y,
and Z are independent and unbiased, then each bit of G(X,Y,Z),
H(X,Y,Z), and I(X,Y,Z) will be independent and unbiased. Note that
the function H is the bit-wise "xor" or "parity" function of its
This step uses a 64-element table T[1 ... 64] constructed from the
sine function. Let T[i] denote the i-th element of the table, which
is equal to the integer part of
times abs(sin(i)), where i
is in radians. The elements of the table are given in the appendix.
Do the following:
/* Process each 16-word block. */
For i = 0 to N/16-1 do
/* Copy block i into X. */
For j = 0 to 15 do
Set X[j] to M[i*16+j].
end /* of loop on j */
/* Save A as AA, B as BB, C as CC, and D as DD. */
/* Round 1. */
/* Let [abcd k s i] denote the operation
a = b + ((a + F(b,c,d) + X[k] + T[i]) &&& s). */
/* Do the following 16 operations. */
[CDAB 10 17 11]
[BCDA 11 22 12]
[DABC 13 12 14]
[CDAB 14 17 15]
[BCDA 15 22 16]
/* Round 2. */
/* Let [abcd k s i] denote the operation
a = b + ((a + G(b,c,d) + X[k] + T[i]) &&& s). */
/* Do the following 16 operations. */
[CDAB 11 14 19]
[CDAB 15 14 23]
[BCDA 12 20 32]
/* Round 3. */
/* Let [abcd k s t] denote the operation
a = b + ((a + H(b,c,d) + X[k] + T[i]) &&& s). */
/* Do the following 16 operations. */
[CDAB 11 16 35]
[BCDA 14 23 36]
[BCDA 10 23 40]
[DABC 12 11 46]
[CDAB 15 16 47]
/* Round 4. */
/* Let [abcd k s t] denote the operation
a = b + ((a + I(b,c,d) + X[k] + T[i]) &&& s). */
/* Do the following 16 operations. */
[CDAB 14 15 51]
[CDAB 10 15 55]
[DABC 15 10 58]
[BCDA 13 21 60]
[DABC 11 10 62]
/* Then perform the following additions. (That is increment each
of the four registers by the value it had before this block
was started.) */
A = A + AA
B = B + BB
C = C + CC
D = D + DD
end /* of loop on i */
3.5 Step 5. Output
The message digest produced as output is A, B, C, D. That is, we
begin with the low-order byte of A, and end with the high-order byte
This completes the description of MD5. A reference implementation in
C is given in the appendix.
MD5算法的实现有5个步骤:
二 补数据长度
三 初始化MD5参数
四 用16块来处理消息
五 输出结果
3 MD5算法描述
We begin by supposing that we have a b-bit message as input, and that
we wish to find its message digest. Here b is an arbitrary
b may be zero, it need not be a multiple of
eight, and it may be arbitrarily large. We imagine the bits of the
message written down as follows:
m_0 m_1 ... m_{b-1}
The following five steps are performed to compute the message digest
of the message.
MD5算法先对输入的数据进行补位,使得数据位长度LEN对512求余的结果是448。即数据扩展至K*512+448位。即K*64+56个字节,K为整数。
具体补位操作:补一个1,然后补0至满足上述要求。
3.2 补数据长度
用一个64位的数字表示数据的原始长度B,把B用两个32位数表示。这时,数
据就被填补成长度为512位的倍数。
3.3 初始化MD5参数
四个32位整数 (A,B,C,D) 用来计算信息摘要,初始化使用的是十六进制表示的数字。
word A: 01 23 45 67
word B: 89 ab cd ef
word C: fe dc ba 98
word D: 76 54 32 10
3.2用16块来处理消息
首先定义3个32位整数(X,Y,Z)作为4个非线性函数的输出参数。
F(X,Y,Z) = XY v not(X) Z
G(X,Y,Z) = XZ v Y not(Z)
H(X,Y,Z) = X xor Y xor Z
I(X,Y,Z) = Y xor (X v not(Z))
//////////函数变换过程,暂略描述///////////////////
具体过程如下:
/* Process each 16-word block. */
For i = 0 to N/16-1 do
/* Copy block i into X. */
For j = 0 to 15 do
Set X[j] to M[i*16+j].
end /* of loop on j */
/* Save A as AA, B as BB, C as CC, and D as DD. */
/* 第1轮. */
/* Let [abcd k s i] denote the operation
a = b + ((a + F(b,c,d) + X[k] + T[i]) &&& s). */
/* Do the following 16 operations. */
[CDAB 10 17 11]
[BCDA 11 22 12]
[DABC 13 12 14]
[CDAB 14 17 15]
[BCDA 15 22 16]
/* 第 2轮. */
/* Let [abcd k s i] denote the operation
a = b + ((a + G(b,c,d) + X[k] + T[i]) &&& s). */
/* Do the following 16 operations. */
[CDAB 11 14 19]
[CDAB 15 14 23]
[BCDA 12 20 32]
/* 第 3轮. */
/* Let [abcd k s t] denote the operation
a = b + ((a + H(b,c,d) + X[k] + T[i]) &&& s). */
/* Do the following 16 operations. */
[CDAB 11 16 35]
[BCDA 14 23 36]
[BCDA 10 23 40]
[DABC 12 11 46]
[CDAB 15 16 47]
/* 第 4轮. */
/* Let [abcd k s t] denote the operation
a = b + ((a + I(b,c,d) + X[k] + T[i]) &&& s). */
/* Do the following 16 operations. */
[CDAB 14 15 51]
[CDAB 10 15 55]
[DABC 15 10 58]
[BCDA 13 21 60]
[DABC 11 10 62]
/* Then perform the following additions. (That is increment each
of the four registers by the value it had before this block
was started.) */
A = A + AA
B = B + BB
C = C + CC
D = D + DD
end /* of loop on i */
3.5 输出结果
消息摘要的输出结果是A,B,C,D,以A为开始的低字节,以D为结束的高字节。
上面完成了MD5的算法描述,一个C的相关实现已在附录中给出。
MD5 加密算法详细介绍
MD5算法详细介绍
没有更多推荐了,骐骥一跃不能十步,驽马十驾功在不舍
MD5加密算法原理及实现
MD5消息摘要算法,属Hash算法一类。MD5算法对输入任意长度的消息进行运行,产生一个128位的消息摘要。
以下所描述的消息长度、填充数据都以位(Bit)为单位,字节序为小端字节。
1、数据填充
对消息进行数据填充,使消息的长度对512取模得448,设消息长度为X,即满足X mod 512=448。根据此公式得出需要填充的数据长度。
填充方法:在消息后面进行填充,填充第一位为1,其余为0。
2、添加消息长度
在第一步结果之后再填充上原消息的长度,可用来进行的存储长度为64位。如果消息长度大于264,则只使用其低64位的值,即(消息长度 对 264取模)。
在此步骤进行完毕后,最终消息长度就是512的整数倍。
3、数据处理
准备需要用到的数据:
4个常数: A = 0x,
B = 0x0EFCDAB89, C = 0x98BADCFE, D = 0x;4个函数: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));
把消息分以512位为一分组进行处理,每一个分组进行4轮变换,以上面所说4个常数为起始变量进行计算,重新输出4个变量,以这4个变量再进行下一分组的运算,如果已经是最后一个分组,则这4个变量为最后的结果,即MD5值。
具体计算的实现较为复杂,建议查阅相关书籍,下面给出在C++上的实现代码。
1 #ifndef MD5H
2 #define MD5H
3 #include &math.h&
4 #include &Windows.h&
6 void ROL(unsigned int &s, unsigned short cx); //32位数循环左移实现函数
7 void ltob(unsigned int &i); //B\L互转,接受UINT类型
8 unsigned int* MD5(const char* mStr); //接口函数,并执行数据填充,计算MD5时调用此函数
1 #include "MD5.h"
3 /*4组计算函数*/
4 inline unsigned int F(unsigned int X, unsigned int Y, unsigned int Z)
return (X & Y) | ((~X) & Z);
8 inline unsigned int G(unsigned int X, unsigned int Y, unsigned int Z)
return (X & Z) | (Y & (~Z));
12 inline unsigned int H(unsigned int X, unsigned int Y, unsigned int Z)
return X ^ Y ^ Z;
16 inline unsigned int I(unsigned int X, unsigned int Y, unsigned int Z)
return Y ^ (X | (~Z));
20 /*4组计算函数结束*/
22 /*32位数循环左移实现函数*/
23 void ROL(unsigned int &s, unsigned short cx)
if (cx & 32)cx %= 32;
s = (s && cx) | (s && (32 - cx));
30 /*B\L互转,接收UINT类型*/
31 void ltob(unsigned int &i)
unsigned int tmp =//保存副本
byte *psour = (byte*)&tmp, *pdes = (byte*)&i;
pdes += 3;//调整指针,准备左右调转
for (short i = 3; i &= 0; --i)
CopyMemory(pdes - i, psour + i, 1);
44 MD5循环计算函数,label=第几轮循环(1&=label&=4),lGroup数组=4个种子副本,M=数据(16组32位数指针)
45 种子数组排列方式: --A--D--C--B--,即 lGroup[0]=A; lGroup[1]=D; lGroup[2]=C; lGroup[3]=B;
47 void AccLoop(unsigned short label, unsigned int *lGroup, void *M)
unsigned int *i1, *i2, *i3, *i4, TAcc, tmpi = 0; //定义:4个指针; T表累加器; 局部变量
typedef unsigned int(*clac)(unsigned int X, unsigned int Y, unsigned int Z); //定义函数类型
const unsigned int rolarray[4][4] = {
{ 7, 12, 17, 22 },
{ 5, 9, 14, 20 },
{ 4, 11, 16, 23 },
{ 6, 10, 15, 21 }
};//循环左移-位数表
const unsigned short mN[4][16] = {
{ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 },
{ 1, 6, 11, 0, 5, 10, 15, 4, 9, 14, 3, 8, 13, 2, 7, 12 },
{ 5, 8, 11, 14, 1, 4, 7, 10, 13, 0, 3, 6, 9, 12, 15, 2 },
{ 0, 7, 14, 5, 12, 3, 10, 1, 8, 15, 6, 13, 4, 11, 2, 9 }
};//数据坐标表
const unsigned int *pM = static_cast&unsigned int*&(M);//转换类型为32位的Uint
TAcc = ((label - 1) * 16) + 1; //根据第几轮循环初始化T表累加器
clac clacArr[4] = { F, G, H, I }; //定义并初始化计算函数指针数组
/*一轮循环开始(16组-&16次)*/
for (short i = 0; i & 16; ++i)
/*进行指针自变换*/
i1 = lGroup + ((0 + i) % 4);
i2 = lGroup + ((3 + i) % 4);
i3 = lGroup + ((2 + i) % 4);
i4 = lGroup + ((1 + i) % 4);
/*第一步计算开始: A+F(B,C,D)+M[i]+T[i+1] 注:第一步中直接计算T表*/
tmpi = (*i1 + clacArr[label - 1](*i2, *i3, *i4) + pM[(mN[label - 1][i])] + (unsigned int)(0xUL * abs(sin((double)(TAcc + i)))));
ROL(tmpi, rolarray[label - 1][i % 4]);//第二步:循环左移
*i1 = *i2 +//第三步:相加并赋值到种子
84 /*接口函数,并执行数据填充*/
85 unsigned int* MD5(const char* mStr)
unsigned int mLen = strlen(mStr); //计算字符串长度
if (mLen & 0) return 0;
unsigned int FillSize = 448 - ((mLen * 8) % 512); //计算需填充的bit数
unsigned int FSbyte = FillSize / 8; //以字节表示的填充数
unsigned int BuffLen = mLen + 8 + FS //缓冲区长度或者说填充后的长度
unsigned char *md5Buff = new unsigned char[BuffLen]; //分配缓冲区
CopyMemory(md5Buff, mStr, mLen); //复制字符串到缓冲区
/*数据填充开始*/
md5Buff[mLen] = 0x80; //第一个bit填充1
ZeroMemory(&md5Buff[mLen + 1], FSbyte - 1); //其它bit填充0,另一可用函数为FillMemory
unsigned long long lenBit = mLen * 8ULL; //计算字符串长度,准备填充
CopyMemory(&md5Buff[mLen + FSbyte], &lenBit, 8); //填充长度
/*数据填充结束*/
/*运算开始*/
unsigned int LoopNumber = BuffLen / 64; //以16个字为一分组,计算分组数量
unsigned int A = 0x, B = 0x0EFCDAB89, C = 0x98BADCFE, D = 0x;//初始4个种子,小端类型
unsigned int *lGroup = new unsigned int[4]{ A, D, C, B}; //种子副本数组,并作为返回值返回
for (unsigned int Bcount = 0; Bcount & LoopN ++Bcount) //分组大循环开始
/*进入4次计算的小循环*/
for (unsigned short Lcount = 0; Lcount & 4;)
AccLoop(++Lcount, lGroup, &md5Buff[Bcount * 64]);
/*数据相加作为下一轮的种子或者最终输出*/
A = (lGroup[0] += A);
B = (lGroup[3] += B);
C = (lGroup[2] += C);
D = (lGroup[1] += D);
/*转换内存中的布局后才能正常显示*/
ltob(lGroup[0]);
ltob(lGroup[1]);
ltob(lGroup[2]);
ltob(lGroup[3]);
delete[] md5B //清除内存并返回
再给出调用实例(以win32控制台应用程序为例):
1 #include &iostream&
2 #include &string.h&
3 #include &stdlib.h&
4 #include "MD5.h"
6 int main(int argc, char **argv)
char tmpstr[256], buf[4][10];
std::cout && "请输入要加密的字符串:";
std::cin &&
unsigned int* tmpGroup = MD5(tmpstr);
sprintf_s(buf[0], "%8X", tmpGroup[0]);
sprintf_s(buf[1], "%8X", tmpGroup[3]);
sprintf_s(buf[2], "%8X", tmpGroup[2]);
sprintf_s(buf[3], "%8X", tmpGroup[1]);
std::cout &&"MD5:"&& buf[0] && buf[1] && buf[2] && buf[3] && std::
delete[] tmpG
return 0; //在此下断点才能看到输出的值
MD5算法原理
浅谈md5加密
&MD5&加密算法全解析
md5 实现原理
MD5加密算法简单实现
MD5加密算法的原理和应用
MD5算法实现注意点
md5加密以及大概逻辑的了解
没有更多推荐了,说来惭愧,做开发几年了,一直在吸取,今天也写写自已关于技术的一点点理解,不正之处,请大家多多指点。
由于之前开发的项目使用的是C#,用户信息使用的C#的MD5加密码方式,而现在需要切换到Java平台下,关键问题是如何将用户信息通过Java方式的MD5加密码到与C#同样的结果。
经过查询资料与测试,Java与C#默认的MD5加密结果是一致的,主要是编码问题。
C#代码 &默认编码加密
class Program
static void Main(string[] args)
String cleanString = "111111";
System.Console.Write(MD5(cleanString));
Console.Read();
public static string MD5(string sText)
Byte[] clearBytes =Encoding.Default.GetBytes(sText);
Byte[] hashedBytes = ((HashAlgorithm)CryptoConfig.CreateFromName("MD5")).ComputeHash(clearBytes);
return BitConverter.ToString(hashedBytes);
Java代码 &默认编码加密
1 public static void main(String[] args) throws NoSuchAlgorithmException,
UnsupportedEncodingException {
String s = "111111";
System.out.println(makeMD5(s)); ;
public static String makeMD5(String password) {
md = MessageDigest.getInstance("MD5");
md.update(password.getBytes());
byte[] bPwd=md.digest();
String pwd = new BigInteger(1, bPwd) .toString(16);
if(pwd.length()%2==1){
int length=pwd.length();
StringBuffer sb=new StringBuffer(length+length/2-1);
for(int i=0;i&i+=2){
sb.append(pwd.substring(i, i+2));
if(i+2&length)
sb.append("-");
return sb.toString().toUpperCase();
} catch (Exception e) {
e.printStackTrace();
说明:为了C#达到一致的格式,这里做了循环格式化&
测试二 Unicode编码
C# 将 上述代码中
Byte[] clearBytes =Encoding.Default.GetBytes(sText);
Byte[] clearBytes =Encoding.Unicode.GetBytes(sText);
70-66-A4-0F-42-77-69-CC-43-34-7A-A9-6B-72-93-1A
1 md.update(password.getBytes());
1 md.update(password.getBytes("UTF-16LE"));
70-66-A4-0F-42-77-69-CC-43-34-7A-A9-6B-72-93-1A
经过多轮测试,结果如下:
java与C#通过MD5加密结果不致,一般都是编码问题,下面列出编码对照
JAVA(加密码111111)
C#(加密码111111)
96-E7-92-18-96-5E-B7-2C-92-A5-49-DD-5A-33-01-12
96-E7-92-18-96-5E-B7-2C-92-A5-49-DD-5A-33-01-12
ISO-8859-1&
96-E7-92-18-96-5E-B7-2C-92-A5-49-DD-5A-33-01-12
ISO-8859-1
96-E7-92-18-96-5E-B7-2C-92-A5-49-DD-5A-33-01-12
96-E7-92-18-96-5E-B7-2C-92-A5-49-DD-5A-33-01-12
96-E7-92-18-96-5E-B7-2C-92-A5-49-DD-5A-33-01-12
AA-61-7C-C9-92-81-C9-F5-1C-A0-72-9D-B9-30-FD-3D
BigEndianUnicode
AA-61-7C-C9-92-81-C9-F5-1C-A0-72-9D-B9-30-FD-3D
70-66-A4-0F-42-77-69-CC-43-34-7A-A9-6B-72-93-1A
70-66-A4-0F-42-77-69-CC-43-34-7A-A9-6B-72-93-1A
6A-97-04-80-3E-CC-65-94-2F-A4-4E-F7-3A-11-B7-80
96-E7-92-18-96-5E-B7-2C-92-A5-49-DD-5A-33-01-12
B7-7D-95-DB-0C-A3-41-3E-0F-79-F4-C5-47-F8-25-E5
java编码:
以上是个人一点总结,欢迎指正!
阅读(...) 评论()MD5、SHA-1、HMAC、HMAC-MD5和HMAC-SHA1摘要输出长度分别是多少呀?
[问题点数:20分,结帖人IDS]
本版专家分:40
结帖率 100%
CSDN今日推荐
本版专家分:297
本版专家分:405
本版专家分:86
本版专家分:40
本版专家分:405
本版专家分:40
匿名用户不能发表回复!|
其他相关推荐常用加密方式笔记
1 Base64加密方式(可逆)
Base64中的可打印字符包括字母A-Z/a-z/数组0-9/ 加号’+’斜杠’/’ 这样共有62个字符
Base64 ios7之后加入系统库
中 的几种模式 ,在需要与服务端或者交互式要沟通好需要处理的字符。
CRLF 这个参数看起来比较眼熟,它就是Win风格的换行符,意思就是使用CR LF这一对作为一行的结尾而不是Unix风格的LF
DEFAULT 这个参数是默认,使用默认的方法来加密
NO_PADDING 这个参数是略去加密字符串最后的”=”
NO_WRAP 这个参数意思是略去所有的换行符(设置后CRLF就没用了)
URL_SAFE 这个参数意思是加密时不使用对URL和文件名有特殊意义的字符来作为加密字符,具体就是以-和_取代+和/
因为各个系统间会有特殊字符处理不同的情况。有个简单的方式直接用 NO_WRAP 模式加密后,进行utf-8处理。
原理:字符一个占1byte,而在64中是占四分之三byte表示.64以3byte长度为一小节,如果原字符不够3byte则自行以“0”补全成3byte长度。补全这部分一般用“=”
Message Digest Algorithm MD5(中文名为消息摘要算法第五版)为计算机安全领域广泛使用的一种散列函数,用以提供消息的完整性保护
是计算机广泛使用的杂凑算法之一(又译摘要算法、哈希算法),主流编程语言普遍已有MD5实现。
根据输出值,不能得到原始的明文,即其过程不可逆
MD5算法具有以下特点:
1、压缩性:任意长度的数据,算出的MD5值长度都是固定的。
2、容易计算:从原数据计算出MD5值很容易。
3、抗修改性:对原数据进行任何改动,哪怕只修改1个字节,所得到的MD5值都有很大区别。
4、强抗碰撞:已知原数据和其MD5值,想找到一个具有相同MD5值的数据(即伪造数据)是非常困难的。
MD5的作用是让大容量信息在用数字签名软件签署私人密钥前被”压缩"成一种保密的格式(就是把一个任意长度的字节串变换成一定长的十六进制数字串)。除了MD5以外,其中比较有名的还有sha-1、RIPEMD以及Haval等。
用途:前端用户密码进行md5加密后,通过网络传输到后台,后台拿到加密后的字符串比对自身数据库加密后的字符串(加密更安全,不是为了完全阻挡攻击,而是为了提高攻击的成本,降低被攻下的概率)。
3 钥匙串加密方式(仅在苹果使用)
iCloud钥匙串,苹果给我们提供的密码保存的解决方案,iOS7之后有的
1、如果手机越狱,密码容易被窃取。
2、当软件更新时,沙盒里的内容是不被删除的。但是,如果将软件卸载后重装,沙盒里的数据就没有了。
3、每个APP的沙盒是相对独立的,密码无法共用。
存钥匙串里:
1、苹果提供的安全方案,rsa加密,相对安全。
2、无论软件更新或删除,密码都存在,都可以自动登录。
3、同一公司的APP密码是可以共用的。
4 对称加密算法
优点:算法公开、计算量小、加密速度快、加密效率高、可逆
缺点:双方使用相同钥匙,安全性得不到保证
现状:对称加密的速度比公钥加密快很多,在很多场合都需要对称加密,
算法: 在对称加密算法中常用的算法有:、、TDEA、、RC2、RC4、、、SKIPJACK、AES等。不同算法的实现机制不同,可参考对应算法的详细资料
相较于DES和3DES算法而言,AES算法有着更高的速度和资源使用效率,安全级别也较之更高了,被称为下一代加密标准
nECB :电子代码本,就是说每个块都是独立加密的
nCBC :密码块链,使用一个密钥和一个初始化向量 (IV)对数据执行加密转换
ECB和CBC区别:CBC更加复杂更加安全,里面加入了8位的向量(8个0的话结果等于ECB)。在明文里面改一个字母,ECB密文对应的那一行会改变,CBC密文从那一行往后都会改变。
5 RSA加密(非对称加密算法)(Secruty.framework系统库)
非对称加密算法需要两个密钥:公开密钥(publickey)和私有密钥(privatekey)
非对称加密中使用的主要算法有:、、背包算法、Rabin、D-H、(椭圆曲线加密算法)等。
公开密钥与私有密钥是一对,如果用公开密钥对数据进行加密,只有用对应的私有密钥才能解密;如果用私有密钥对数据进行加密,那么只有用对应的公开密钥才能解密
非对称密码体制的特点:算法强度复杂、安全性依赖于算法与密钥但是由于其算法复杂,而使得加密解密速度没有对称加密解密的速度快
对称密码体制中只有一种密钥,并且是非公开的,如果要解密就得让对方知道密钥。所以保证其安全性就是保证密钥的安全,而非对称密钥体制有两种密钥,其中一个是公开的,这样就可以不需要像对称密码那样传输对方的密钥了
但是RSA加密算法效率较差,对大型数据加密时间很长,一般用于小数据。
一把是乙方产生公钥、私钥。乙方将公钥给甲方,甲方用公钥对数据进行加密然后上传给乙方。
几种常用加密方式简要分析及建议
java中常用的加密方式
常见的WEB加密方式
Android 常用的数据加密方式
常见加密方式
开发过程中主要的三种加密方式
常用的PHP加密方式
常见的加密方式
没有更多推荐了,

我要回帖

更多关于 九宫四位算法 的文章

 

随机推荐