473,394 Members | 1,371 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

encode/decoder algorithm to secure password

Hi,

I am using VB6 and SQL Server 2000.

I want to design a logon form. In this form, how can I use a Password field to store in encrypted form in tbluser table and how can I compare password text in this table?

Please tell me how I can use encode/decoder algorithm to secure password.

User form coding is as follows :-

Expand|Select|Wrap|Line Numbers
  1. Dim sql As String
  2. Dim adcon As ADODB.Connection
  3. Dim rs As ADODB.Recordset
  4. Dim sqldata As String
  5.  
  6. Private Sub Form_Load()
  7.     'get a connection
  8.     cmd = "Provider=sqloledb;" & "Data Source=xyz;" & "Initial Catalog=edp07;" & "User Id=sa;"
  9.     Set adcon = New ADODB.Connection
  10.     adcon.Open cmd
  11.     sqldata = "select * from tbluser"
  12.     'Set new ADO recordset object
  13.     Set rs = New ADODB.Recordset
  14.     rs.Open sqldata, adcon, adOpenStatic, adLockOptimistic    
  15. End Sub
  16.  
  17. Private Sub cmdAdd_Click()
  18.     'Coding to clear the text box
  19.     txtId.Text = ""
  20.     txtUser.Text = ""
  21.     txtPassword.Text = ""
  22.     'txtDId.SetFocus
  23.     rs.AddNew
  24. End Sub
  25.  
  26. Private Sub cmdSave_Click()
  27.         rs(0) = txtId.Text
  28.         rs(1) = txtUser.Text
  29.     '**** I Want to save this field in encrypted form in SQL Server 2000 in table tbluser ! pls help me ****
  30.         rs(2) = txtPassword.Text
  31.         rs.Update
  32.         MsgBox "Entry  Saved"
  33.         rs.Requery        
  34. End Sub

Login form coding is as follows :-

Expand|Select|Wrap|Line Numbers
  1. Option Explicit
  2. Dim adcon As ADODB.Connection
  3. Dim rs As ADODB.Recordset
  4. Dim sqldata As String
  5. Dim cmd As String
  6. Public LoginSucceeded As Boolean
  7.  
  8. Private Sub Form_Load()
  9.    'get a connection
  10.     cmd = "Provider=sqloledb;" & "Data Source=xyz;" & "Initial Catalog=edp07;" & "User Id=sa;"
  11.     Set adcon = New ADODB.Connection
  12.     adcon.Open cmd
  13.     sqldata = "select * from tbluser"
  14.     'Set new ADO recordset object
  15.     Set rs = New ADODB.Recordset
  16.     rs.Open sqldata, adcon, adOpenStatic, adLockOptimistic    
  17. End Sub
  18.  
  19. Private Sub cmdOK_Click()
  20.     'check for correct password
  21.     If rs.RecordCount = 0 Then
  22.         MsgBox ("No recordset")
  23.         Exit Sub
  24.     End If
  25.     'check for correct username and password
  26.     rs.MoveFirst
  27.     Do While Not rs.EOF
  28.     If txtUserName = RTrim(rs.Fields("name")) Then
  29. '**** I Want to compare encrypted data in SQL Server 2000 in table tbl user! Please help me ****
  30.         If txtPassword = RTrim(rs.Fields("Password")) Then
  31.             LoginSucceeded = True
  32.             Me.Hide
  33.             Form1.Show
  34.        End If
  35.     End If
  36.     rs.MoveNext
  37.     Loop
  38.     If Not LoginSucceeded Then
  39.         MsgBox "Invalid UserName/Password, try again!", , "Login"
  40.         txtPassword.SetFocus
  41.         SendKeys "{Home}+{End}"
  42.     End If
  43. End Sub
Can anyone help?

Thanks.

pawan
Sep 12 '07 #1
1 2459
hariharanmca
1,977 1GB
Try it your self to encode and decode the data. We will help you.
Sep 12 '07 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

9
by: Jay | last post by:
Hi everybody ! I've used the "crypt()" function in PHP to save password of a user logging in a web-based system. Based on a book that I've read (PHP advanced by Larry UllMan), there is no way...
4
by: Bob Bedford | last post by:
I've to give the client ID to my customers. As this number will be used in a third part app, and I only rely on this number for checking the user's existence (I can't change the third part app),...
2
by: Jason Smith | last post by:
I have recently designed an application in Ms Access with the folllowing security: 1) Database is split into a front-end / backend with linked tables 2) All modules are password protected 3)...
1
by: AR | last post by:
I would like to know more about the Encode/Decode feature available within MS Access. This is what I have read from Microsoft Office OnLine: "The simplest method of protection is to encode the...
113
by: Bonj | last post by:
I was in need of an encryption algorithm to the following requirements: 1) Must be capable of encrypting strings to a byte array, and decyrpting back again to the same string 2) Must have the same...
11
by: Wm. Scott Miller | last post by:
Hello all! We are building applications here and have hashing algorithms to secure secrets (e.g passwords) by producing one way hashes. Now, I've read alot and I've followed most of the advice...
0
by: Spiffytech | last post by:
I'm trying to retrieve emails via the POP3 protocol from a Windows 2003 POP3 Server. I get a positive response from the server when sending all the commands until the "PASS" command. When I send...
14
by: knal | last post by:
Hi there, I'm looking for a secure login script for a sort-of-community site... (PHP, MySQL, sessions, or maybe something else ... ) I know there are a lot of scripts out there, but none of them...
6
by: Nebulism | last post by:
Hey everyone, I am currently creating images pixel by pixel. This is too slow for many images. Anyways, I want to use the fromstring module in the Image library. I have read at this url,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.