View Single Post
Sponsorlu Bağlantılar
Zoque.Forum
Advertisement
Old 26.07.2007   #3 (permalink)
Sargon
 
Sargon's Avatar
 
Üyelik Tarihi: 02.05.2005
Yer: İstanbul
Mesaj: 135
Re: ASP ile SHA1 (Hash) değeri üretmek

Bugün ASP ile hash hesaplanmasına benimde ihtiyacım oldu @xedition verdiğin ilk örnek işe yarıyor, teşekkür ederim fakat garantinin yeni 3Dsi için yeterli değil. Ek olarak kodun base64 e çevrilmesi gerekiyor. Onun için ise aşağıdaki fonksiyonu kullanabilirsiniz.

PHP Code:

<%
' Functions to provide encoding/decoding of strings with Base64.

' Encoding: myEncodedString = base64_encode( inputString )
DecodingmyDecodedString base64_decodeencodedInputString )
'
Programmed by Markus Hartsmar for ShameDesigns in 2002. 
' Email me at: mark@shamedesigns.com
Visit our website athttp://www.shamedesigns.com/
'

    Dim Base64Chars
    Base64Chars =    "ABCDEFGHIJKLMNOPQRSTUVWXYZ" & _
            "abcdefghijklmnopqrstuvwxyz" & _
            "0123456789" & _
            "+/"


    ' 
Functions for encoding string to Base64
    
Public Function base64_encodebyVal strIn )
        
Dim c1c2c3w1w2w3w4nstrOut
        
For 1 To LenstrIn Step 3
            c1 
AscMidstrInn) )
            
c2 AscMidstrIn1) + Chr(0) )
            
c3 AscMidstrIn2) + Chr(0) )
            
w1 Intc1 ) : w2 = ( c1 And ) * 16 Intc2 16 )
            If 
LenstrIn ) >= 1 Then 
                w3 
= ( c2 And 15 ) * Intc3 64 
            Else 
                
w3 = -1
            End 
If
            If 
LenstrIn ) >= 2 Then 
                w4 
c3 And 63 
            
Else 
                
w4 = -1
            End 
If
            
strOut strOut mimeencodew1 ) + mimeencodew2 ) + _
                      mimeencode
w3 ) + mimeencodew4 )
        
Next
        base64_encode 
strOut
    End 
Function

    Private Function 
mimeencodebyVal intIn )
        If 
intIn >= 0 Then 
            mimeencode 
MidBase64CharsintIn 1
        Else 
            
mimeencode ""
        
End If
    
End Function    


     Function 
to decode string from Base64
    
Public Function base64_decodebyVal strIn )
        
Dim w1w2w3w4nstrOut
        
For 1 To LenstrIn Step 4
            w1 
mimedecodeMidstrInn) )
            
w2 mimedecodeMidstrIn1) )
            
w3 mimedecodeMidstrIn2) )
            
w4 mimedecodeMidstrIn3) )
            If 
w2 >= 0 Then _
                strOut 
strOut _
                    Chr
( ( ( w1 Intw2 16 ) ) And 255 ) )
            If 
w3 >= 0 Then _
                strOut 
strOut _
                    Chr
( ( ( w2 16 Intw3 ) ) And 255 ) )
            If 
w4 >= 0 Then _
                strOut 
strOut _
                    Chr
( ( ( w3 64 w4 ) And 255 ) )
        
Next
        base64_decode 
strOut
    End 
Function

    Private Function 
mimedecodebyVal strIn )
        If 
LenstrIn ) = 0 Then 
            mimedecode 
= -: Exit Function
        Else
            
mimedecode InStrBase64CharsstrIn ) - 1
        End 
If
    
End Function

%> 
Sargon şu an çevrimdışı   Mesajdan alıntı yaparak yeni bir cevap ekleyin