VB 3.0, VB 4.0 (16-bit), VB 4.0 (32-bit), VB 5.0, VB 6.0, VB Script, ASP (Active Server Pages) , VBA MS Access, VBA MS Excel
Views:
4204
Simple Checksum Algorithm implemented in VB.
Terms of Agreement:
By using this article, you agree to the following terms...
You may use
this article in your own programs (and may compile it into a program and distribute it in compiled format for languages that allow it) freely and with no charge.
You MAY NOT redistribute this article (for example to a web site) without written permission from the original author. Failure to do so is a violation of copyright laws.
You may link to this article from another website, but ONLY if it is not wrapped in a frame.
You will abide by any additional copyright restrictions which the author may have placed in the article or article's description.
Public Function MakeHash(ByVal pText As String) As String
Dim I As Long, Hash As String, Temp As Integer, TempNum As Currency
For I = 1 To Len(pText)
Temp = (Asc(Mid$(pText, I, 1)))
TempNum = TempNum + Temp
TempNum = TempNum Mod 955360000
Next
TempNum = TempNum Mod 955360000
MakeHash = Valida(Hex$(TempNum))
End Function
Public Function Valida(ByVal pText As String) As String
Select Case Len(pText)
Case 1
Valida = String$(7, Asc("0")) & pText
Case 2
Valida = String$(6, Asc("0")) & pText
Case 3
Valida = String$(5, Asc("0")) & pText
Case 4
Valida = String$(4, Asc("0")) & pText
Case 5
Valida = String$(3, Asc("0")) & pText
Case 6
Valida = String$(2, Asc("0")) & pText
Case 7
Valida = String$(1, Asc("0")) & pText
Case Else
Valida = pText
End Select
End Function
Report Bad Submission
Your Vote
Other User Comments
There are no comments on this submission.
Add Your Feedback
Your feedback will be posted below and an email sent to
the author. Please remember that the author was kind enough to
share this with you, so any criticisms must be stated politely, or they
will be deleted. (For feedback not related to this particular article, please
click here instead.)