- Home
·
- Encryption
·
- Validates a credit card number using the Luhn Modulo 10+5 algorithm. Doesn't tell you if it's a liv
Validates a credit card number using the Luhn Modulo 10+5 algorithm. Doesn't tell you if it's a liv
Validates a credit card number using the Luhn Modulo 10+5 algorithm. Doesn't tell you if it's a live credit cardnumber just that it would be
Rate Validates a credit card number using the Luhn Modulo 10+5 algorithm. Doesn't tell you if it's a liv
(2(2 Vote))
Function LuhnVerify(ByVal CC As String) As Boolean
Dim s As String
Dim ctr As Integer
'force the number to atleast one digit
CC = "0" & Trim(CC)
' force card number to even length
If Len(CC) <> (Len(CC) / 2) Then
CC = "0" & CC
End If
For n = (Len(CC) - 1) To 1 Step -2
s = s & (2 * Val(Mid(CC, n, 1)))
Next
For n = (Len(CC)) To 1 Step -2
s = s & Mid(CC, n, 1)
Next
For n = 1 To Len(s)
ctr = ctr + Val(Mid(s, n, 1))
Next
ctr = ctr Mod 10
If ctr = 0 Or ctr = 5 Then ' supports Mod 10+5 Variant
LuhnVerify = True
Else
LuhnVerify = False
End If
End Function
Validates a credit card number using the Luhn Modulo 10+5 algorithm. Doesn't tell you if it's a liv Comments
No comments yet — be the first to post one!
Post a Comment