⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 nvo_md5.sru

📁 在powerbuilder 7.0中实现md5的算法
💻 SRU
📖 第 1 页 / 共 3 页
字号:
       if ll_wordarraycount + 8 > 0 and ll_wordarraycount + 8 <= upperbound(ll_temp) then
              ll_d = this.of_hh(ll_d,ll_a,ll_b,ll_c,ll_temp[ll_wordarraycount + 8],ll_word_list[10],-2022574463)
       end if
       if ll_wordarraycount + 11 > 0 and ll_wordarraycount + 11 <= upperbound(ll_temp) then
              ll_c = this.of_hh(ll_c,ll_d,ll_a,ll_b,ll_temp[ll_wordarraycount + 11],ll_word_list[11],1839030562)
       end if
       if ll_wordarraycount + 14 > 0 and ll_wordarraycount + 14 <= upperbound(ll_temp) then
              ll_b = this.of_hh(ll_b,ll_c,ll_d,ll_a,ll_temp[ll_wordarraycount + 14],ll_word_list[12],-35309556)
       end if
       if ll_wordarraycount + 1 > 0 and ll_wordarraycount + 1 <= upperbound(ll_temp) then
              ll_a = this.of_hh(ll_a,ll_b,ll_c,ll_d,ll_temp[ll_wordarraycount + 1],ll_word_list[9],-1530992060)
       end if
       if ll_wordarraycount + 4 > 0 and ll_wordarraycount + 4 <= upperbound(ll_temp) then
              ll_d = this.of_hh(ll_d,ll_a,ll_b,ll_c,ll_temp[ll_wordarraycount + 4],ll_word_list[10],1272893353)
       end if
       if ll_wordarraycount + 7 > 0 and ll_wordarraycount + 7 <= upperbound(ll_temp) then
              ll_c = this.of_hh(ll_c,ll_d,ll_a,ll_b,ll_temp[ll_wordarraycount + 7],ll_word_list[11],-155497632)
       end if
       if ll_wordarraycount + 10 > 0 and ll_wordarraycount + 10 <= upperbound(ll_temp) then
              ll_b = this.of_hh(ll_b,ll_c,ll_d,ll_a,ll_temp[ll_wordarraycount + 10],ll_word_list[12],-1094730640)
       end if
       if ll_wordarraycount + 13 > 0 and ll_wordarraycount + 13 <= upperbound(ll_temp) then
              ll_a = this.of_hh(ll_a,ll_b,ll_c,ll_d,ll_temp[ll_wordarraycount + 13],ll_word_list[9],681279174)
       end if
       if ll_wordarraycount + 0 > 0 and ll_wordarraycount + 0 <= upperbound(ll_temp) then
              ll_d = this.of_hh(ll_d,ll_a,ll_b,ll_c,ll_temp[ll_wordarraycount + 0],ll_word_list[10],-358537222)
       end if
       if ll_wordarraycount + 3 > 0 and ll_wordarraycount + 3 <= upperbound(ll_temp) then
              ll_c = this.of_hh(ll_c,ll_d,ll_a,ll_b,ll_temp[ll_wordarraycount + 3],ll_word_list[11],-722521979)
       end if
       if ll_wordarraycount + 6 > 0 and ll_wordarraycount + 6 <= upperbound(ll_temp) then
              ll_b = this.of_hh(ll_b,ll_c,ll_d,ll_a,ll_temp[ll_wordarraycount + 6],ll_word_list[12],76029189)
       end if
       if ll_wordarraycount + 9 > 0 and ll_wordarraycount + 9 <= upperbound(ll_temp) then
              ll_a = this.of_hh(ll_a,ll_b,ll_c,ll_d,ll_temp[ll_wordarraycount + 9],ll_word_list[9],-640364487)
       end if
       if ll_wordarraycount + 12 > 0 and ll_wordarraycount + 12 <= upperbound(ll_temp) then
              ll_d = this.of_hh(ll_d,ll_a,ll_b,ll_c,ll_temp[ll_wordarraycount + 12],ll_word_list[10],-421815835)
       end if
       if ll_wordarraycount + 15 > 0 and ll_wordarraycount + 15 <= upperbound(ll_temp) then
              ll_c = this.of_hh(ll_c,ll_d,ll_a,ll_b,ll_temp[ll_wordarraycount + 15],ll_word_list[11],530742520)
       end if
       if ll_wordarraycount + 2 > 0 and ll_wordarraycount + 2 <= upperbound(ll_temp) then
              ll_b = this.of_hh(ll_b,ll_c,ll_d,ll_a,ll_temp[ll_wordarraycount + 2],ll_word_list[12],-995338651)
       end if
       //第四轮运算
       if ll_wordarraycount + 0 > 0 and ll_wordarraycount + 0 <= upperbound(ll_temp) then
              ll_a = this.of_ii(ll_a,ll_b,ll_c,ll_d,ll_temp[ll_wordarraycount + 0],ll_word_list[13],-198630844)
       end if
       if ll_wordarraycount + 7 > 0 and ll_wordarraycount + 7 <= upperbound(ll_temp) then
              ll_d = this.of_ii(ll_d,ll_a,ll_b,ll_c,ll_temp[ll_wordarraycount + 7],ll_word_list[14],1126891415)
       end if
       if ll_wordarraycount + 14 > 0 and ll_wordarraycount + 14 <= upperbound(ll_temp) then
              ll_c = this.of_ii(ll_c,ll_d,ll_a,ll_b,ll_temp[ll_wordarraycount + 14],ll_word_list[15],-1416354905)
       end if
       if ll_wordarraycount + 5 > 0 and ll_wordarraycount + 5 <= upperbound(ll_temp) then
              ll_b = this.of_ii(ll_b,ll_c,ll_d,ll_a,ll_temp[ll_wordarraycount + 5],ll_word_list[16],-57434055)
       end if
       if ll_wordarraycount + 12 > 0 and ll_wordarraycount + 12 <= upperbound(ll_temp) then
              ll_a = this.of_ii(ll_a,ll_b,ll_c,ll_d,ll_temp[ll_wordarraycount + 12],ll_word_list[13],1700485571)
       end if
       if ll_wordarraycount + 3 > 0 and ll_wordarraycount + 3 <= upperbound(ll_temp) then
              ll_d = this.of_ii(ll_d,ll_a,ll_b,ll_c,ll_temp[ll_wordarraycount + 3],ll_word_list[14],-1894986606)
       end if
       if ll_wordarraycount + 10 > 0 and ll_wordarraycount + 10 <= upperbound(ll_temp) then
              ll_c = this.of_ii(ll_c,ll_d,ll_a,ll_b,ll_temp[ll_wordarraycount + 10],ll_word_list[15],-1051523)
       end if
       if ll_wordarraycount + 1 > 0 and ll_wordarraycount + 1 <= upperbound(ll_temp) then
              ll_b = this.of_ii(ll_b,ll_c,ll_d,ll_a,ll_temp[ll_wordarraycount + 1],ll_word_list[16],-2054922799)
       end if
       if ll_wordarraycount + 8 > 0 and ll_wordarraycount + 8 <= upperbound(ll_temp) then
              ll_a = this.of_ii(ll_a,ll_b,ll_c,ll_d,ll_temp[ll_wordarraycount + 8],ll_word_list[13],1873313359)
       end if
       if ll_wordarraycount + 15 > 0 and ll_wordarraycount + 15 <= upperbound(ll_temp) then
              ll_d = this.of_ii(ll_d,ll_a,ll_b,ll_c,ll_temp[ll_wordarraycount + 15],ll_word_list[14],-30611744)
       end if
       if ll_wordarraycount + 6 > 0 and ll_wordarraycount + 6 <= upperbound(ll_temp) then
              ll_c = this.of_ii(ll_c,ll_d,ll_a,ll_b,ll_temp[ll_wordarraycount + 6],ll_word_list[15],-1560198380)
       end if
       if ll_wordarraycount + 13 > 0 and ll_wordarraycount + 13 <= upperbound(ll_temp) then
              ll_b = this.of_ii(ll_b,ll_c,ll_d,ll_a,ll_temp[ll_wordarraycount + 13],ll_word_list[16],1309151649)
       end if
       if ll_wordarraycount + 4 > 0 and ll_wordarraycount + 4 <= upperbound(ll_temp) then
              ll_a = this.of_ii(ll_a,ll_b,ll_c,ll_d,ll_temp[ll_wordarraycount + 4],ll_word_list[13],-145523070)
       end if
       if ll_wordarraycount + 11 > 0 and ll_wordarraycount + 11 <= upperbound(ll_temp) then
              ll_d = this.of_ii(ll_d,ll_a,ll_b,ll_c,ll_temp[ll_wordarraycount + 11],ll_word_list[14],-1120210379)
       end if
       if ll_wordarraycount + 2 > 0 and ll_wordarraycount + 2 <= upperbound(ll_temp) then
              ll_c = this.of_ii(ll_c,ll_d,ll_a,ll_b,ll_temp[ll_wordarraycount + 2],ll_word_list[15],718787259)
       end if
       if ll_wordarraycount + 9 > 0 and ll_wordarraycount + 9 <= upperbound(ll_temp) then
              ll_b = this.of_ii(ll_b,ll_c,ll_d,ll_a,ll_temp[ll_wordarraycount + 9],ll_word_list[16],-343485551)
       end if
       //中间结果向右位移
       ll_a = this.of_addunsigned(ll_a,ll_aa)
       ll_b = this.of_addunsigned(ll_b,ll_bb)
       ll_c = this.of_addunsigned(ll_c,ll_cc)
       ll_d = this.of_addunsigned(ll_d,ll_dd)
 
       ll_wordarraycount = ll_wordarraycount + 16 - 1
loop
 
//生成128位散列值
ls_return = lower(this.of_wordtohex(ll_a) + this.of_wordtohex(ll_b) + this.of_wordtohex(ll_c) + this.of_wordtohex(ll_d))
 
return ls_return
end function

private function long of_f (readonly long al_x, readonly long al_y, readonly long al_z);
/*******************************************************************
函数名称:of_f()
参数:     al_x long 值1
                      al_y long 值2
                      al_z long 值3
返回值: long 位运算结果
功能描述:md5加密时的位运算之一
*******************************************************************/
return inv_numerical.of_bitwiseor(inv_numerical.of_bitwiseand(al_x,al_y),inv_numerical.of_bitwiseand((al_x + 1) * (-1),al_z))
end function

private function long of_ff (readonly long al_a, readonly long al_b, readonly long al_c, readonly long al_d, readonly long al_x, readonly long al_s, readonly long al_ac);/*******************************************************************
函数名称:of_ff()
参数:     al_a long 值1
                      al_b long 值2
                      al_c long 值3
                      al_d long 值4
                      al_x long 值5
                      al_s long 值6
                      al_ac long 值7
返回值: long 运算结果
功能描述:md5加密时的运算之一
*******************************************************************/
long ll_return
 
ll_return = this.of_f(al_b,al_c,al_d)
ll_return = this.of_addunsigned(ll_return,al_x)
ll_return = this.of_addunsigned(ll_return,al_ac)
ll_return = this.of_addunsigned(al_a,ll_return)
ll_return = this.of_rotateleft(ll_return,al_s)
ll_return = this.of_addunsigned(ll_return,al_b)
 
return ll_return
end function

private function long of_g (readonly long al_x, readonly long al_y, readonly long al_z);
/*******************************************************************
函数名称:of_g()
参数:     al_x long 值1
                      al_y long 值2
                      al_z long 值3
返回值: long 位运算结果
功能描述:md5加密时的位运算之一
*******************************************************************/
return inv_numerical.of_bitwiseor(inv_numerical.of_bitwiseand(al_x,al_z),inv_numerical.of_bitwiseand(al_y,(al_z + 1) * (-1)))
end function

private function long of_getunicode (string as_char);
/*******************************************************************
函数名称:of_getunicode()
参数:     as_char string 字符
返回值: long unicode编码
功能描述:取字符的unicode编码
*******************************************************************/
long ll_len_old,ll_len_new
long ll_return
 
ll_len_old = len(as_char)
ll_len_new = 2 * ll_len_old
MultiByteToWideChar(0, 0, as_char, ll_len_old, ll_return, ll_len_new)
if ll_return < 0 then 
	ll_return = 65536 - abs(ll_return)
end if
return ll_return
 
end function

private function long of_gg (readonly long al_a, readonly long al_b, readonly long al_c, readonly long al_d, readonly long al_x, readonly long al_s, readonly long al_ac);
/*******************************************************************
函数名称:of_gg()
参数:     al_a long 值1
                      al_b long 值2
                      al_c long 值3
                      al_d long 值4
                      al_x long 值5
                      al_s long 值6
                      al_ac long 值7
返回值: long 运算结果
功能描述:md5加密时的运算之一
*******************************************************************/
long ll_return
 
ll_return = this.of_g(al_b,al_c,al_d)
ll_return = this.of_addunsigned(ll_return,al_x)
ll_return = this.of_addunsigned(ll_return,al_ac)
ll_return = this.of_addunsigned(al_a,ll_return)
ll_return = this.of_rotateleft(ll_return,al_s)
ll_return = this.of_addunsigned(ll_return,al_b)
 
return ll_return
end function

private function long of_h (readonly long al_x, readonly long al_y, readonly long al_z);
/*******************************************************************
函数名称:of_h()
参数:     al_x long 值1
                      al_y long 值2
                      al_z long 值3
返回值: long 位运算结果
功能描述:md5加密时的位运算之一
*******************************************************************/
return inv_numerical.of_bitwisexor(inv_numerical.of_bitwisexor(al_x,al_y),al_z)
end function

private function long of_hh (readonly long al_a, readonly long al_b, readonly long al_c, readonly long al_d, readonly long al_x, readonly long al_s, readonly long al_ac);/*******************************************************************
函数名称:of_hh()
参数:     al_a long 值1
                      al_b long 值2
                      al_c long 值3
                      al_d long 值4
                      al_x long 值5
                      al_s long 值6
                      al_ac long 值7
返回值: long 运算结果
功能描述:md5加密时的运算之一
*******************************************************************/
long ll_return
 
ll_return = this.of_h(al_b,al_c,al_d)
ll_return = this.of_addunsigned(ll_return,al_x)
ll_return = this.of_addunsigned(ll_return,al_ac)
ll_return = this.of_addunsigned(al_a,ll_return)
ll_return = this.of_rotateleft(ll_return,al_s)
ll_return = this.of_addunsigned(ll_return,al_b)
 

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -