how do i hash from plaintext to ciphertext in visual basic 6.0. I want to hash from the plaintext before i save it in the database and hash from ciphertext to plaintext before logining in. I need your help.
Printable View
how do i hash from plaintext to ciphertext in visual basic 6.0. I want to hash from the plaintext before i save it in the database and hash from ciphertext to plaintext before logining in. I need your help.
Hello , You can use the 'String.GetHashCode' function to get a hash for a string's. and also Check this link http://www.di-mgt.com.au/cryptoBlowfishDemo.html
Why don't you go something like this code? It should work on your side as it does on my computer.
Code:Public Function Encode(ByVal plaintext As String)
Dim ciphertext As String
Dim magic_buffer As String
Dim ctc As String
Dim magic_number As Long
Dim length As Long
Dim count As Long
Dim mncount As Long
Dim ptc As Long
Dim baz As Long
Dim foo As Long
Dim bar As Long
magic_buffer = "ERGergergerERGergaasa23AWf4"
length = Len(plaintext)
magic_number = Int((255 - 0 + 1) * Rnd()) + 0
ciphertext = Hex(magic_number)
If magic_number < 16 Then
ciphertext = "0" & ciphertext
End If
count = 0
mncount = 0
While count < length
ptc = Asc(Len(plaintext))
baz = ptc + magic_number
If baz > 255 Then
bar = ptc + 1
foo = bar + magic_number - 256
Else
foo = ptc + magic_number
End If
magic_number = foo Xor Asc(Len((magic_buffer)))
ctc = Hex(foo Xor Asc(Len((magic_buffer))))
If Len(ctc) = 1 Then
ctc = "0" + ctc
End If
ciphertext = ciphertext + ctc
count = count + 1
mncount = mncount + 1
If mncount > 27 Then
mncount = 1
End If
ciphertext = UCase(ciphertext)
Wend
ciphertext = UCase(ciphertext)
FunctionName = ciphertext
End Function