Discuz! 密碼產生器 與 後台修改教學
本文章最後由 rictirse 於 2012-12-15 11:43 編輯1.進入SQL
2.pre_ucenter_members
3.選擇用戶
4.按編輯
1.password 輸入 PSWv2的內容
2.salt輸入salt的內容 (salt一定為六位數的隨機亂數)
#include <GUIConstantsEx.au3>
#include <GuiEdit.au3>
#include <WindowsConstants.au3>
Opt("GUIOnEventMode", 1)
Global Const $BITS_TO_A_BYTE= 8
Global Const $BYTES_TO_A_WORD = 4
Global Const $BITS_TO_A_WORD= $BYTES_TO_A_WORD * $BITS_TO_A_BYTE
Global $m_lOnBits
Global $m_l2Power
Global $tmpPSW,$tmpSalt,$PSWv2
GUICreate ( "Discuz! Password Generator", 378, 128, Default, Default, 1)
GUISetOnEvent ( $GUI_EVENT_CLOSE, "SpecialEvents")
GUICtrlCreateLabel ( "PSW V1", 10, 13, 50, 20)
GUICtrlCreateLabel ( "Salt", 10, 44, 50, 20)
GUICtrlCreateLabel ( "PSW V2", 10, 75, 50, 20)
$iPSW = GUICtrlCreateInput ( "", 60, 10, 300, 20)
$iSalt = GUICtrlCreateInput ( "", 60, 40, 300, 20)
_GUICtrlEdit_SetLimitText (-1, 6)
$oPSW = GUICtrlCreateInput ( "", 60, 70, 300, 20)
GUISetState()
GUIRegisterMsg( $WM_COMMAND, "MY_WM_COMMAND")
While True
If GUICtrlRead ($iPSW) <> "" And GUICtrlRead ($iSalt) <> "" Then
If GUICtrlRead ($iPSW) <> $tmpPSW Or GUICtrlRead ($iSalt) <> $tmpSalt Then
If StringLen (GUICtrlRead ($iSalt)) >= 6 Then
$tmpPSW = GUICtrlRead ($iPSW)
$tmpSalt = GUICtrlRead ($iSalt)
$PSWv2 = PasswordConver( $tmpPSW, $tmpSalt)
GUICtrlSetData ($oPSW,$PSWv2)
EndIf
EndIf
EndIf
Sleep (50)
WEnd
Func MY_WM_COMMAND($hWnd, $msg, $wParam, $lParam)
Local $nNotifyCode = BitShift($wParam,16)
Local $nID = BitAND ($wParam, 0xFFFF)
Local $hCtrl = $lParam
Switch $nID
Case $iSalt
If $nNotifyCode = 256 And StringLen (GUICtrlRead ($iSalt)) >= 6 Then
ToolTip (GUICtrlRead ($iSalt))
ClipPut(GUICtrlRead ($iSalt))
Sleep (500)
ToolTip ("")
EndIf
Case $oPSW
If $nNotifyCode = 256 And GUICtrlRead ($iSalt) <> "" Then
ToolTip (GUICtrlRead ($oPSW))
ClipPut(GUICtrlRead ($oPSW))
Sleep (500)
ToolTip ("")
EndIf
EndSwitch
EndFunc
Func SpecialEvents()
Switch @GUI_CtrlId
Case $GUI_EVENT_CLOSE
Exit
EndSwitch
EndFunc
Func PasswordConver( $Password, $Salt)
Local $sDigest
$sDigest = md5($Password)
$sDigest = md5($Password&$Salt)
Return $sDigest
EndFunc
Func Class_Initialize()
$m_lOnBits = 1
$m_lOnBits = 3
$m_lOnBits = 7
$m_lOnBits = 15
$m_lOnBits = 31
$m_lOnBits = 63
$m_lOnBits = 127
$m_lOnBits = 255
$m_lOnBits = 511
$m_lOnBits = 1023
$m_lOnBits = 2047
$m_lOnBits = 4095
$m_lOnBits = 8191
$m_lOnBits = 16383
$m_lOnBits = 32767
$m_lOnBits = 65535
$m_lOnBits = 131071
$m_lOnBits = 262143
$m_lOnBits = 524287
$m_lOnBits = 1048575
$m_lOnBits = 2097151
$m_lOnBits = 4194303
$m_lOnBits = 8388607
$m_lOnBits = 16777215
$m_lOnBits = 33554431
$m_lOnBits = 67108863
$m_lOnBits = 134217727
$m_lOnBits = 268435455
$m_lOnBits = 536870911
$m_lOnBits = 1073741823
$m_lOnBits = 2147483647
$m_l2Power = 1
$m_l2Power = 2
$m_l2Power = 4
$m_l2Power = 8
$m_l2Power = 16
$m_l2Power = 32
$m_l2Power = 64
$m_l2Power = 128
$m_l2Power = 256
$m_l2Power = 512
$m_l2Power = 1024
$m_l2Power = 2048
$m_l2Power = 4096
$m_l2Power = 8192
$m_l2Power = 16384
$m_l2Power = 32768
$m_l2Power = 65536
$m_l2Power = 131072
$m_l2Power = 262144
$m_l2Power = 524288
$m_l2Power = 1048576
$m_l2Power = 2097152
$m_l2Power = 4194304
$m_l2Power = 8388608
$m_l2Power = 16777216
$m_l2Power = 33554432
$m_l2Power = 67108864
$m_l2Power = 134217728
$m_l2Power = 268435456
$m_l2Power = 536870912
$m_l2Power = 1073741824
EndFunc
Func LShift($lValue,$iShiftBits)
If $iShiftBits = 0 Then
Return $lValue
ElseIf $iShiftBits = 31 Then
If BitAND($lValue, 1) Then
Return 0x80000000
Else
Return 0
Endif
ElseIf $iShiftBits < 0 Or $iShiftBits > 31 Then
SetError(6)
Endif
If BitAND($lValue, $m_l2Power) Then
Return BitOR((BitAND($lValue, $m_lOnBits) * _
$m_l2Power[$iShiftBits]) , 0x80000000)
Else
Return (BitAND($lValue, $m_lOnBits) * _
$m_l2Power[$iShiftBits])
Endif
EndFunc
Func RShift($lValue, $iShiftBits)
Local $RShift
If $iShiftBits = 0 Then
Return $lValue
ElseIf $iShiftBits = 31 Then
If BitAND($lValue, 0x80000000) Then
Return 1
Else
Return 0
Endif
ElseIf $iShiftBits < 0 Or $iShiftBits > 31 Then
SetError(6)
Endif
$RShift = int(BitAND($lValue, 0x7FFFFFFE) / $m_l2Power[$iShiftBits])
If BitAND($lValue, 0x80000000) Then
$RShift = int(BitOR($RShift, (0x40000000 / $m_l2Power[$iShiftBits - 1])))
Endif
Return $RShift
EndFunc
Func RShiftSigned($lValue , $iShiftBits)
If $iShiftBits = 0 Then
Return $lValue
ElseIf $iShiftBits = 31 Then
If BitAND($lValue, 0x80000000) Then
Return -1
Else
Return 0
Endif
ElseIf $iShiftBits < 0 Or $iShiftBits > 31 Then
SetError(6)
Endif
Return Int($lValue / $m_l2Power[$iShiftBits])
EndFunc
Func RotateLeft($lValue , $iShiftBits)
Return BitOR(LShift($lValue, $iShiftBits), RShift($lValue, (32 - $iShiftBits)))
EndFunc
Func AddUnsigned($lX , $lY )
$lX8 = BitAND($lX, 0x80000000)
$lY8 = BitAND($lY, 0x80000000)
$lX4 = BitAND($lX, 0x40000000)
$lY4 = BitAND($lY, 0x40000000)
$lResult = BitAND($lX, 0x3FFFFFFF) + BitAND($lY, 0x3FFFFFFF)
If BitAND($lX4, $lY4) Then
$lResult = BitXOR($lResult, 0x80000000, $lX8, $lY8)
ElseIf BitOR($lX4 , $lY4) Then
If BitAND($lResult, 0x40000000) Then
$lResult = BitXOR($lResult, 0xC0000000, $lX8, $lY8)
Else
$lResult = BitXOR($lResult, 0x40000000, $lX8, $lY8)
Endif
Else
$lResult = BitXOR($lResult, $lX8, $lY8)
Endif
Return $lResult
EndFunc
Func F($x , $y , $z )
Return BitOR(BitAND($x, $y) , BitAND((BitNOT($x)), $z))
EndFunc
Func G($x , $y , $z )
Return BitOR(BitAND($x, $z) , BitAND($y , (BitNOT($z))))
EndFunc
Func H($x , $y , $z )
Return BitXOR($x , $y , $z)
EndFunc
Func I($x , $y , $z )
Return BitXOR($y , BitOR($x , (BitNOT($z))))
EndFunc
Func FF(ByRef $a , $b , $c , $d , $x , $s , $ac )
$a = AddUnsigned($a, AddUnsigned(AddUnsigned(F($b, $c, $d), $x), $ac))
$a = RotateLeft($a, $s)
$a = AddUnsigned($a, $b)
EndFunc
Func GG(ByRef $a , $b , $c , $d , $x , $s , $ac )
$a = AddUnsigned($a, AddUnsigned(AddUnsigned(G($b, $c, $d), $x), $ac))
$a = RotateLeft($a, $s)
$a = AddUnsigned($a, $b)
EndFunc
Func HH(ByRef $a , $b , $c , $d , $x , $s , $ac )
$a = AddUnsigned($a, AddUnsigned(AddUnsigned(H($b, $c, $d), $x), $ac))
$a = RotateLeft($a, $s)
$a = AddUnsigned($a, $b)
EndFunc
Func II(ByRef $a , $b , $c , $d , $x , $s , $ac )
$a = AddUnsigned($a, AddUnsigned(AddUnsigned(I($b, $c, $d), $x), $ac))
$a = RotateLeft($a, $s)
$a = AddUnsigned($a, $b)
EndFunc
Func ConvertToWordArray($sMessage )
Dim $lWordArray
Const $MODULUS_BITS = 512
Const $CONGRUENT_BITS = 448
$lMessageLength = StringLen($sMessage)
$lNumberOfWords = (int(($lMessageLength + _
int(($MODULUS_BITS - $CONGRUENT_BITS) / $BITS_TO_A_BYTE)) / _
int($MODULUS_BITS / $BITS_TO_A_BYTE)) + 1) * _
int($MODULUS_BITS / $BITS_TO_A_WORD)
ReDim $lWordArray[$lNumberOfWords]
$lBytePosition = 0
$lByteCount = 0
Do
$lWordCount = int($lByteCount / $BYTES_TO_A_WORD)
$lBytePosition = (Mod($lByteCount , $BYTES_TO_A_WORD)) * $BITS_TO_A_BYTE
$lWordArray[$lWordCount] = BitOR($lWordArray[$lWordCount] , _
LShift(Asc(StringMid($sMessage, $lByteCount + 1, 1)), $lBytePosition))
$lByteCount = $lByteCount + 1
Until $lByteCount >= $lMessageLength
$lWordCount = int($lByteCount / $BYTES_TO_A_WORD)
$lBytePosition = (Mod($lByteCount , $BYTES_TO_A_WORD)) * $BITS_TO_A_BYTE
$lWordArray[$lWordCount] = BitOR($lWordArray[$lWordCount] , _
LShift(0x80, $lBytePosition))
$lWordArray[$lNumberOfWords - 2] = LShift($lMessageLength, 3)
$lWordArray[$lNumberOfWords - 1] = RShift($lMessageLength, 29)
Return $lWordArray
EndFunc
Func WordToHex($lValue)
$WordToHex=""
For $lCount = 0 To 3
$lByte = BitAND(RShift($lValue, $lCount * $BITS_TO_A_BYTE) , _
$m_lOnBits[$BITS_TO_A_BYTE - 1])
$WordToHex = $WordToHex & StringRight("0" & Hex($lByte,2), 2)
Next
Return $WordToHex
EndFunc
Func MD5($sMessage)
Const $S11= 7
Const $S12= 12
Const $S13= 17
Const $S14= 22
Const $S21= 5
Const $S22= 9
Const $S23= 14
Const $S24= 20
Const $S31= 4
Const $S32= 11
Const $S33= 16
Const $S34= 23
Const $S41= 6
Const $S42= 10
Const $S43= 15
Const $S44= 21
Class_Initialize()
$x = ConvertToWordArray($sMessage)
$a = 0x67452301
$b = 0xEFCDAB89
$c = 0x98BADCFE
$d = 0x10325476
For $k = 0 To UBound($x)-1 Step 16
$AA = $a
$BB = $b
$CC = $c
$DD = $d
FF( $a, $b, $c, $d, $x[$k + 0], $S11, 0xD76AA478 )
FF( $d, $a, $b, $c, $x[$k + 1], $S12, 0xE8C7B756 )
FF( $c, $d, $a, $b, $x[$k + 2], $S13, 0x242070DB )
FF( $b, $c, $d, $a, $x[$k + 3], $S14, 0xC1BDCEEE )
FF( $a, $b, $c, $d, $x[$k + 4], $S11, 0xF57C0FAF )
FF( $d, $a, $b, $c, $x[$k + 5], $S12, 0x4787C62A )
FF( $c, $d, $a, $b, $x[$k + 6], $S13, 0xA8304613 )
FF( $b, $c, $d, $a, $x[$k + 7], $S14, 0xFD469501 )
FF( $a, $b, $c, $d, $x[$k + 8], $S11, 0x698098D8 )
FF( $d, $a, $b, $c, $x[$k + 9], $S12, 0x8B44F7AF )
FF( $c, $d, $a, $b, $x[$k + 10], $S13, 0xFFFF5BB1)
FF( $b, $c, $d, $a, $x[$k + 11], $S14, 0x895CD7BE)
FF( $a, $b, $c, $d, $x[$k + 12], $S11, 0x6B901122)
FF( $d, $a, $b, $c, $x[$k + 13], $S12, 0xFD987193)
FF( $c, $d, $a, $b, $x[$k + 14], $S13, 0xA679438E)
FF( $b, $c, $d, $a, $x[$k + 15], $S14, 0x49B40821)
GG( $a, $b, $c, $d, $x[$k + 1], $S21, 0xF61E2562 )
GG( $d, $a, $b, $c, $x[$k + 6], $S22, 0xC040B340 )
GG( $c, $d, $a, $b, $x[$k + 11], $S23, 0x265E5A51)
GG( $b, $c, $d, $a, $x[$k + 0], $S24, 0xE9B6C7AA )
GG( $a, $b, $c, $d, $x[$k + 5], $S21, 0xD62F105D )
GG( $d, $a, $b, $c, $x[$k + 10], $S22, 0x2441453 )
GG( $c, $d, $a, $b, $x[$k + 15], $S23, 0xD8A1E681)
GG( $b, $c, $d, $a, $x[$k + 4], $S24, 0xE7D3FBC8 )
GG( $a, $b, $c, $d, $x[$k + 9], $S21, 0x21E1CDE6 )
GG( $d, $a, $b, $c, $x[$k + 14], $S22, 0xC33707D6)
GG( $c, $d, $a, $b, $x[$k + 3], $S23, 0xF4D50D87 )
GG( $b, $c, $d, $a, $x[$k + 8], $S24, 0x455A14ED )
GG( $a, $b, $c, $d, $x[$k + 13], $S21, 0xA9E3E905)
GG( $d, $a, $b, $c, $x[$k + 2], $S22, 0xFCEFA3F8 )
GG( $c, $d, $a, $b, $x[$k + 7], $S23, 0x676F02D9 )
GG( $b, $c, $d, $a, $x[$k + 12], $S24, 0x8D2A4C8A)
HH( $a, $b, $c, $d, $x[$k + 5], $S31, 0xFFFA3942 )
HH( $d, $a, $b, $c, $x[$k + 8], $S32, 0x8771F681 )
HH( $c, $d, $a, $b, $x[$k + 11], $S33, 0x6D9D6122)
HH( $b, $c, $d, $a, $x[$k + 14], $S34, 0xFDE5380C)
HH( $a, $b, $c, $d, $x[$k + 1], $S31, 0xA4BEEA44 )
HH( $d, $a, $b, $c, $x[$k + 4], $S32, 0x4BDECFA9 )
HH( $c, $d, $a, $b, $x[$k + 7], $S33, 0xF6BB4B60 )
HH( $b, $c, $d, $a, $x[$k + 10], $S34, 0xBEBFBC70)
HH( $a, $b, $c, $d, $x[$k + 13], $S31, 0x289B7EC6)
HH( $d, $a, $b, $c, $x[$k + 0], $S32, 0xEAA127FA )
HH( $c, $d, $a, $b, $x[$k + 3], $S33, 0xD4EF3085 )
HH( $b, $c, $d, $a, $x[$k + 6], $S34, 0x4881D05)
HH( $a, $b, $c, $d, $x[$k + 9], $S31, 0xD9D4D039 )
HH( $d, $a, $b, $c, $x[$k + 12], $S32, 0xE6DB99E5)
HH( $c, $d, $a, $b, $x[$k + 15], $S33, 0x1FA27CF8)
HH( $b, $c, $d, $a, $x[$k + 2], $S34, 0xC4AC5665 )
II( $a, $b, $c, $d, $x[$k + 0], $S41, 0xF4292244 )
II( $d, $a, $b, $c, $x[$k + 7], $S42, 0x432AFF97 )
II( $c, $d, $a, $b, $x[$k + 14], $S43, 0xAB9423A7)
II( $b, $c, $d, $a, $x[$k + 5], $S44, 0xFC93A039 )
II( $a, $b, $c, $d, $x[$k + 12], $S41, 0x655B59C3)
II( $d, $a, $b, $c, $x[$k + 3], $S42, 0x8F0CCC92 )
II( $c, $d, $a, $b, $x[$k + 10], $S43, 0xFFEFF47D)
II( $b, $c, $d, $a, $x[$k + 1], $S44, 0x85845DD1 )
II( $a, $b, $c, $d, $x[$k + 8], $S41, 0x6FA87E4F )
II( $d, $a, $b, $c, $x[$k + 15], $S42, 0xFE2CE6E0)
II( $c, $d, $a, $b, $x[$k + 6], $S43, 0xA3014314 )
II( $b, $c, $d, $a, $x[$k + 13], $S44, 0x4E0811A1)
II( $a, $b, $c, $d, $x[$k + 4], $S41, 0xF7537E82 )
II( $d, $a, $b, $c, $x[$k + 11], $S42, 0xBD3AF235)
II( $c, $d, $a, $b, $x[$k + 2], $S43, 0x2AD7D2BB )
II( $b, $c, $d, $a, $x[$k + 9], $S44, 0xEB86D391 )
$a = AddUnsigned($a, $AA)
$b = AddUnsigned($b, $BB)
$c = AddUnsigned($c, $CC)
$d = AddUnsigned($d, $DD)
Next
Return StringLower(WordToHex($a) & WordToHex($b) & WordToHex($c) & WordToHex($d))
EndFunc
感謝你的發表喔
原來版大你也有研究dz啊~~ esofthard 發表於 2012-12-22 12:48 static/image/common/back.gif
感謝你的發表喔
原來版大你也有研究dz啊~~
略懂略懂
頁:
[1]