C 16位MD5加密演算法的乙個錯誤測試資料處理

2021-08-22 09:13:30 字數 3279 閱讀 2959

網路上搜尋一大堆的md5加密的**,輸入字元"wuxiaomei*",你會發現系統出錯

所以最好成績還是按照下面的**修改你的資料程式吧.

public string mymd5(string str,int code)

else//32位加密 }

網路上md5常用類的加密演算法**如下

using system;

using system.text;

namespace my_workspace

else

else

return lshift;

} else }

} if (convert.toboolean((lvalue & m_l2power[31 - ishiftbits])))

else

return lshift;

} private static long rshift(long lvalue, long ishiftbits)

else

else

return rshift;

} else }

} rshift = (lvalue & 0x7ffffffe) / m_l2power[ishiftbits];

if (convert.toboolean((lvalue & 0x80000000)))

return rshift;

} private static long rotateleft(long lvalue, long ishiftbits)

private static long addunsigned(long lx, long ly)

else if (convert.toboolean(lx4 | ly4))

else }

else

addunsigned = lresult;

return addunsigned;

} private static long md5_f(long x, long y, long z)

private static long md5_g(long x, long y, long z)

private static long md5_h(long x, long y, long z)

private static long md5_i(long x, long y, long z)

private static void md5_ff(ref long a, long b, long c, long d, long x, long s, long ac)

private static void md5_gg(ref long a, long b, long c, long d, long x, long s, long ac)

private static void md5_hh(ref long a, long b, long c, long d, long x, long s, long ac)

private static void md5_ii(ref long a, long b, long c, long d, long x, long s, long ac)

private static long converttowordarray(string smessage)

lwordcount = lbytecount / bytes_to_a_word;

lbyteposition = (lbytecount % bytes_to_a_word) * bits_to_a_byte;

lwordarray[lwordcount] = lwordarray[lwordcount] | lshift(0x80, lbyteposition);

lwordarray[lnumberofwords - 2] = lshift(lmessagelength, 3);

lwordarray[lnumberofwords - 1] = rshift(lmessagelength, 29);

converttowordarray = lwordarray;

return converttowordarray;

} private static string wordtohex(long lvalue)

return wordtohex;

} private static string tohex(long dec)

return strhex;

} private static string tohex(long hex)

return strhex;

} public static string encrypt(string smessage, int stype)

long x = null;

int k = 0;

long aa = 0;

long bb = 0;

long cc = 0;

long dd = 0;

long a = 0;

long b = 0;

long c = 0;

long d = 0;

const int s11 = 7;

const int s12 = 12;

const int s13 = 17;

const int s14 = 22;

const int s21 = 5;

const int s22 = 9;

const int s23 = 14;

const int s24 = 20;

const int s31 = 4;

const int s32 = 11;

const int s33 = 16;

const int s34 = 23;

const int s41 = 6;

const int s42 = 10;

const int s43 = 15;

const int s44 = 21;

x = converttowordarray(smessage);

a = 0x67452301;

b = 0xefcdab89;

c = 0x98badcfe;

d = 0x10325476;

for (k = 0; k < x.length; k += 16)

if (stype == 32)

else

return md5;

} }

}

C 16位MD5加密演算法的乙個錯誤測試資料處理

網路上搜尋一大堆的md5加密的 輸入字元 wuxiaomei 你會發現系統出錯 所以最好成績還是按照下面的 修改你的資料程式吧.public string mymd5 string str,int code else 32位加密 網路上md5常用類的加密演算法 如下 using system usi...

MD5 加密演算法 c語言

摘自openssl global.h ifndef prototypes define prototypes 0 endif pointer defines a generic pointer type typedef unsigned char pointer uint2 defines a tw...

MD5加密演算法(C 版)

此演算法使用c 寫成。更多詳細內容可參考github專案 填充字串函式 在長度為k bits的原始訊息尾部填充長度為p bits的標識 1000 00 其中1 p 512 即至少需要填充乙個bit 使得填充後的訊息位數為 k p 448 mod 512 注意,當k 448 mod 512 時,填充的...