
a[href^="mailto"] { color: blue; }

a[href^="mailto"]:hover:after { content: " > " attr(title); }

.rotating-ads img {
width:250px;
height:250px;
border:1px solid #bbb;
}

Public Class EcwidSSO



Private Shared ReadOnly UnixEpoch As New DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc)



Public Shared Function GetCurrentUnixTimestampSeconds() As Long

Return CLng((DateTime.UtcNow - UnixEpoch).TotalSeconds)

End Function



Public Shared Function HashToSha1WithTimestamp() As String

Dim secretkey As String = "XbZz5gP2n7M3" 

Dim message As String = System.Convert.ToBase64String(System.Text.Encoding .UTF8.GetBytes("{appId:'elcomCMS',userId:'3',profi le:{email:'user1@test.com.au'}}"))

Dim unixTimestamp As Long = GetCurrentUnixTimestampSeconds() 

Dim hmac As String = HashToSha1(message + " " + unixTimestamp.ToString, secretkey)



Return String.Format(<script type="text/javascript"> var ecwid_sso_profile='{0}';</script>.ToString, message + " " + hmac + " " + unixTimestamp.ToString)

End Function





Private Shared Function HashToSha1(message As String, secretkey As String) As String

Dim encoding As New System.Text.ASCIIEncoding()

Dim keyByte As Byte() = encoding.GetBytes(secretkey)

Dim hmacsha1 As New Security.Cryptography.HMACSHA1(keyByte)

Dim messageBytes As Byte() = encoding.GetBytes(message)

Dim hashmessage As Byte() = hmacsha1.ComputeHash(messageBytes)

Return ByteToString(hashmessage)

End Function



Private Shared Function ByteToString(ByVal buff As Byte()) As String

Dim sbinary As String = ""



For i As Integer = 0 To buff.Length - 1

' hex format

sbinary += buff(i).ToString("X2")

Next

Return (sbinary)

End Function



End Class
