TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Naidu AMMAN
NA
37
35.3k
please explain this fun code.(Cryptography.EncryptDecrypt)
Mar 3 2015 7:04 AM
Public Function calculateCustomerChecksum(ByVal xlWorkSheet As Microsoft.Office.Interop.Excel.Worksheet, ByVal rownumber As Integer) As Boolean
Try
Dim i As Integer = 0, checksum1 As Double, strchecksum1 As String, checksum2 As Double, strchecksum2 As String
Dim signchecksum1 As Double = 0, signchecksum2 As Double = 0
For i = 2 To rownumber - 1
checksum1 += System.Convert.ToDouble(Trim(CheckForZero(xlWorkSheet.Cells(i, 9).Value)))
checksum2 += System.Convert.ToDouble(Trim(CheckForZero(xlWorkSheet.Cells(i, 10).Value)))
Application.DoEvents()
Next
signchecksum1 = checksum1
signchecksum2 = checksum2
'If checksum1 < 0 Then
' checksum1 = -checksum1
'End If
'If checksum2 < 0 Then
' checksum2 = -checksum2
'End If
'strchecksum1 = ((System.Math.Floor(checksum1) * 4123) + 675).ToString & GetDecimalpointValue(checksum1)
'strchecksum1 = calculatelength(strchecksum1) & strchecksum1
'strchecksum1 = strchecksum1 & Addallnumbers(strchecksum1) & "A"
'strchecksum2 = ((System.Math.Floor(checksum2) * 4123) + 675).ToString & GetDecimalpointValue(checksum2)
'strchecksum2 = calculatelength(strchecksum2) & strchecksum2
'strchecksum2 = strchecksum2 & Addallnumbers(strchecksum2) & "A"
'If signchecksum1 < 0 Then
' strchecksum1 = -strchecksum1
'End If
'If signchecksum2 < 0 Then
' strchecksum2 = -strchecksum2
'End If
Dim m_encrypt As New Cryptography.EncryptDecrypt
strchecksum1 = m_encrypt.encrypt(checksum1) & "A"
strchecksum2 = m_encrypt.encrypt(checksum2) & "A"
If Trim(strchecksum1) = Trim((xlWorkSheet.Cells(xlWorkSheet.UsedRange.Rows.Count, 9).Value)) Then
If Trim(strchecksum2) = Trim((xlWorkSheet.Cells(xlWorkSheet.UsedRange.Rows.Count, 10).Value)) Then
' strchecksum2 = ((System.Math.Floor(System.Convert.ToDouble(Trim(CheckForZero(xlWorkSheet.Cells(xlWorkSheet.UsedRange.Rows.Count - 1, 1).Value)))) * 4123) + 675).ToString & GetDecimalpointValue(System.Convert.ToDouble(Trim(CheckForZero(xlWorkSheet.Cells(xlWorkSheet.UsedRange.Rows.Count - 1, 1).Value))))
'strchecksum2 = calculatelength(strchecksum2) & strchecksum2
'strchecksum2 = strchecksum2 & Addallnumbers(strchecksum2) & "A"
strchecksum2 = m_encrypt.encrypt(xlWorkSheet.Cells(xlWorkSheet.UsedRange.Rows.Count - 1, 1).Value) & "A"
If Trim(strchecksum2) = Trim((xlWorkSheet.Cells(xlWorkSheet.UsedRange.Rows.Count, 3).Value)) Then
Return True
Else
Return False
End If
Else
Return False
End If
Else
Return False
End If
Catch ex As Exception
Return False
End Try
Return False
'checksum = calculatelength() & ((System.Math.Floor(checksum) * 4193) + 675).ToString
End Function
Reply
Answers (
1
)
How can we monitor all browser activity in c#
Retrieving Password from Database