<% Function AndW(ByRef pBytWord1Ary, ByRef pBytWord2Ary) Dim lBytWordAry(3) Dim lLngIndex For lLngIndex = 0 To 3 lBytWordAry(lLngIndex) = CByte(pBytWord1Ary(lLngIndex) And pBytWord2Ary(lLngIndex)) Next AndW = lBytWordAry End Function Function OrW(ByRef pBytWord1Ary, ByRef pBytWord2Ary) Dim lBytWordAry(3) Dim lLngIndex For lLngIndex = 0 To 3 lBytWordAry(lLngIndex) = CByte(pBytWord1Ary(lLngIndex) Or pBytWord2Ary(lLngIndex)) Next OrW = lBytWordAry End Function Function XorW(ByRef pBytWord1Ary, ByRef pBytWord2Ary) Dim lBytWordAry(3) Dim lLngIndex For lLngIndex = 0 To 3 lBytWordAry(lLngIndex) = CByte(pBytWord1Ary(lLngIndex) Xor pBytWord2Ary(lLngIndex)) Next XorW = lBytWordAry End Function Function NotW(ByRef pBytWordAry) Dim lBytWordAry(3) Dim lLngIndex For lLngIndex = 0 To 3 lBytWordAry(lLngIndex) = Not CByte(pBytWordAry(lLngIndex)) Next NotW = lBytWordAry End Function Function AddW(ByRef pBytWord1Ary, ByRef pBytWord2Ary) Dim lLngIndex Dim lIntTotal Dim lBytWordAry(3) For lLngIndex = 3 To 0 Step -1 If lLngIndex = 3 Then lIntTotal = CInt(pBytWord1Ary(lLngIndex)) + pBytWord2Ary(lLngIndex) lBytWordAry(lLngIndex) = lIntTotal Mod 256 Else lIntTotal = CInt(pBytWord1Ary(lLngIndex)) + pBytWord2Ary(lLngIndex) + (lIntTotal \ 256) lBytWordAry(lLngIndex) = lIntTotal Mod 256 End If Next AddW = lBytWordAry End Function Function CircShiftLeftW(ByRef pBytWordAry, ByRef pLngShift) Dim lDbl1 Dim lDbl2 lDbl1 = WordToDouble(pBytWordAry) lDbl2 = lDbl1 lDbl1 = CDbl(lDbl1 * (2 ^ pLngShift)) lDbl2 = CDbl(lDbl2 / (2 ^ (32 - pLngShift))) CircShiftLeftW = OrW(DoubleToWord(lDbl1), DoubleToWord(lDbl2)) End Function Function WordToHex(ByRef pBytWordAry) Dim lLngIndex For lLngIndex = 0 To 3 WordToHex = WordToHex & Right("0" & Hex(pBytWordAry(lLngIndex)), 2) Next End Function Function HexToWord(ByRef pStrHex) HexToWord = DoubleToWord(CDbl("&h" & pStrHex)) ' needs "#" at end for VB? End Function Function DoubleToWord(ByRef pDblValue) Dim lBytWordAry(3) lBytWordAry(0) = Int(DMod(pDblValue, 2 ^ 32) / (2 ^ 24)) lBytWordAry(1) = Int(DMod(pDblValue, 2 ^ 24) / (2 ^ 16)) lBytWordAry(2) = Int(DMod(pDblValue, 2 ^ 16) / (2 ^ 8)) lBytWordAry(3) = Int(DMod(pDblValue, 2 ^ 8)) DoubleToWord = lBytWordAry End Function Function WordToDouble(ByRef pBytWordAry) WordToDouble = CDbl((pBytWordAry(0) * (2 ^ 24)) + (pBytWordAry(1) * (2 ^ 16)) + (pBytWordAry(2) * (2 ^ 8)) + pBytWordAry(3)) End Function Function DMod(ByRef pDblValue, ByRef pDblDivisor) Dim lDblMod lDblMod = CDbl(CDbl(pDblValue) - (Int(CDbl(pDblValue) / CDbl(pDblDivisor)) * CDbl(pDblDivisor))) If lDblMod < 0 Then lDblMod = CDbl(lDblMod + pDblDivisor) End If DMod = lDblMod End Function Function F( ByRef lIntT, ByRef pBytWordBAry, ByRef pBytWordCAry, ByRef pBytWordDAry) If lIntT <= 19 Then F = OrW(AndW(pBytWordBAry, pBytWordCAry), AndW((NotW(pBytWordBAry)), pBytWordDAry)) ElseIf lIntT <= 39 Then F = XorW(XorW(pBytWordBAry, pBytWordCAry), pBytWordDAry) ElseIf lIntT <= 59 Then F = OrW(OrW(AndW(pBytWordBAry, pBytWordCAry), AndW(pBytWordBAry, pBytWordDAry)), AndW(pBytWordCAry, pBytWordDAry)) Else F = XorW(XorW(pBytWordBAry, pBytWordCAry), pBytWordDAry) End If End Function Function sha1_Hash(pStrMessage) Dim lLngLen, lBytLenW, lLngTempWordWAry, lLngNumBlocks, lLngBlock, lIntT, lBytTempAry Dim lVarWordWAry(79), lVarWordKAry(3) Dim lStrBlockText, lStrWordText, lStrPadMessage Dim lBytWordH0Ary, lBytWordH1Ary, lBytWordH2Ary, lBytWordH3Ary, lBytWordH4Ary Dim lBytWordAAry, lBytWordBAry, lBytWordCAry, lBytWordDAry, lBytWordEAry, lBytWordFAry lLngLen = Len(cstr(pStrMessage)) lBytLenW = DoubleToWord(CDbl(lLngLen) * 8) lStrPadMessage = pStrMessage & Chr(128) & String((128 - (lLngLen Mod 64) - 9) Mod 64, Chr(0)) & String(4, Chr(0)) & Chr(lBytLenW(0)) & Chr(lBytLenW(1)) & Chr(lBytLenW(2)) & Chr(lBytLenW(3)) lLngNumBlocks = Len(lStrPadMessage) / 64 lVarWordKAry(0) = HexToWord("5A827999") lVarWordKAry(1) = HexToWord("6ED9EBA1") lVarWordKAry(2) = HexToWord("8F1BBCDC") lVarWordKAry(3) = HexToWord("CA62C1D6") lBytWordH0Ary = HexToWord("67452301") lBytWordH1Ary = HexToWord("EFCDAB89") lBytWordH2Ary = HexToWord("98BADCFE") lBytWordH3Ary = HexToWord("10325476") lBytWordH4Ary = HexToWord("C3D2E1F0") For lLngBlock = 0 To lLngNumBlocks - 1 lStrBlockText = Mid(lStrPadMessage, (lLngBlock * 64) + 1, 64) For lIntT = 0 To 15 lStrWordText = Mid(lStrBlockText, (lIntT * 4) + 1, 4) lVarWordWAry(lIntT) = Array(Asc(Mid(lStrWordText, 1, 1)), Asc(Mid(lStrWordText, 2, 1)), Asc(Mid(lStrWordText, 3, 1)), Asc(Mid(lStrWordText, 4, 1))) Next For lIntT = 16 To 79 lVarWordWAry(lIntT) = CircShiftLeftW(XorW(XorW(XorW(lVarWordWAry(lIntT - 3), lVarWordWAry(lIntT - 8)), lVarWordWAry(lIntT - 14)), lVarWordWAry(lIntT - 16)), 1) Next lBytWordAAry = lBytWordH0Ary lBytWordBAry = lBytWordH1Ary lBytWordCAry = lBytWordH2Ary lBytWordDAry = lBytWordH3Ary lBytWordEAry = lBytWordH4Ary For lIntT = 0 To 79 lBytWordFAry = F(lIntT, lBytWordBAry, lBytWordCAry, lBytWordDAry) lBytTempAry = AddW(AddW(AddW(AddW(CircShiftLeftW(lBytWordAAry, 5), lBytWordFAry), lBytWordEAry), lVarWordWAry(lIntT)), lVarWordKAry(lIntT \ 20)) lBytWordEAry = lBytWordDAry lBytWordDAry = lBytWordCAry lBytWordCAry = CircShiftLeftW(lBytWordBAry, 30) lBytWordBAry = lBytWordAAry lBytWordAAry = lBytTempAry Next lBytWordH0Ary = AddW(lBytWordH0Ary, lBytWordAAry) lBytWordH1Ary = AddW(lBytWordH1Ary, lBytWordBAry) lBytWordH2Ary = AddW(lBytWordH2Ary, lBytWordCAry) lBytWordH3Ary = AddW(lBytWordH3Ary, lBytWordDAry) lBytWordH4Ary = AddW(lBytWordH4Ary, lBytWordEAry) Next sha1_Hash = WordToHex(lBytWordH0Ary) & WordToHex(lBytWordH1Ary) & WordToHex(lBytWordH2Ary) & WordToHex(lBytWordH3Ary) & WordToHex(lBytWordH4Ary) End Function %> <% dim importo,mac If isnumeric(request("importo")) and isnumeric(request("importo2")) and instr(request("importo2"),".")=0 and instr(request("importo"),".")=0 and instr(request("importo2"),",")=0 and instr(request("importo"),",")=0 then importo=Cint(request("importo"))*100+Cint(request("importo2")) 'importo=Cint(importo) If request("go")="OK" then mac=lcase(sha1_Hash("codTrans="&request("codTrans")&"divisa="&request("divisa")&"importo="&importo&"trj4i41OA61R4U25A6t3jT1B97F232En51on553M")) response.redirect("https://ecommerce.keyclient.it/ecomm/ecomm/DispatcherServlet?alias=payment_541293&importo="&importo&"&divisa="&request("divisa")&"&codTrans="&request("codTrans")&"&mail=info@coralorafamediterranea.comt&url=http://www.coralorafamediterranea.com/pos/index.php&session_id="&request("session_id")&"&mac="&mac&"&languageId=ITA") end if end if %> Coral Orafa Mediterranea



<%If request("esito")<>"" then%> <%If request("esito")="OK" then%> <%else%> <%end if%>
TRANSAZIONE CORRETTAMENTE ESEGUITA!
TRANSAZIONE FALLITA!
Nome: <%=request("nome") & " " & request("cognome")%>
Carta: <%=request("tipoprodotto")%> - <%=request("pan")%>
Divisa:<%=request("divisa")%>
IMPORTO:<%=cint(request("importo"))/100%>
Sessione:<%=request("session_id")%>
<% end if%>

POS VIRTUALE

,