Overclock.net - Overclocking.net
     
 
Home Gallery Reviews Blogs Register Today's Posts Mark Forums Read Members List


Go Back   Overclock.net - Overclocking.net > Software, Programming and Coding > Coding and Programming

Reply
 
LinkBack Thread Tools
Old 10-15-09   #1 (permalink)
My Raison D'Etre
 
OrphanShadow's Avatar
 
intel

Join Date: Sep 2007
Location: Stoke on Trent - UK
Posts: 1,728

Rep: 284 OrphanShadow is a proven memberOrphanShadow is a proven memberOrphanShadow is a proven member
Unique Rep: 217
Trader Rating: 0
Default How do I create a logon system in VB.NET 2008

I am pondering adding a simple logon screen to an app that I am building for a college project.

I have a simple login window created in VB6 using Random access files and a hashing algorithm (converts to ASCII code, adds then runs a Modulus 197 operation, using that number to place the username and password in a random access flat file), and I was curious about the best way to do it in VB.NET?

System: -[美しい悲劇]-
CPU
Atom N270 1.6Ghz
Motherboard
HP/Intel 945M
Memory
1GB DDR2 667Mhz
Graphics Card
Intel 945
Hard Drive
160GB 5400RPM
Sound Card
Realtek ALC885
Power Supply
External PSU
Case
HP Mini 110
CPU cooling
HeatPipe
GPU cooling
Heatpipe
OS
Windows 7 Pro x86
Monitor
10.1" Display
OrphanShadow is online now Overclocked Account OrphanShadow's Gallery   Reply With Quote
Old 10-17-09   #2 (permalink)
4.0 GHz
 
dharmaBum's Avatar
 
intel nvidia

Join Date: Apr 2007
Location: Raleigh, NC
Posts: 747

Rep: 121 dharmaBum is acknowledged by manydharmaBum is acknowledged by many
Unique Rep: 89
Trader Rating: 0
Default

I'm a bit rusty on this, but I believe .NET has an MD5 class...here it is.

Using this class seems to me to be what you're trying to do.(though I admit I'm a bit of a idiot when it comes to stuff like this).

I did something like this for a ASP.NET site I did work on. It was simple enough to implement as I recall. I was using a SQL database to store the MD5 hash and using the class methods to read it back when required.
__________________
3DMark06: 19091 - 3DMark Vantage: P15264 - SuperPi: 10.968s

Programming Quote of the Day:
Bjarne Stroustrup:
Quote:
There are only two industries that refer to their customers as ‘users’.

System: Europa
CPU
E8500 4.36ghz @ 1.36v
Motherboard
EVGA 780i SLi P05 Bios
Memory
G.SKILL 4GB(2x2GB) @ 924MHz (5-4-4-12-2T)
Graphics Card
2xEVGA 8800GTS (G92) 512MB @800/2000/2110
Hard Drive
Seagate 500gbx2, (fake-)RAID0
Sound Card
Sound Blaster X-Fi XtremeGamer
Power Supply
CORSAIR 1000HX 1000W
Case
Gigabyte GZ-FA2CA-AJB Black Aluminum
CPU cooling
TDX 775 Block, 360 BlackIce rad
GPU cooling
MAZE5x2, TT copper HS
OS
Fedora10-86_64/Vista64
Monitor
22" Samsung SyncMaster 2232BW

Last edited by dharmaBum : 10-17-09 at 01:26 AM
dharmaBum is offline   Reply With Quote
Old 10-17-09   #3 (permalink)
My Raison D'Etre
 
OrphanShadow's Avatar
 
intel

Join Date: Sep 2007
Location: Stoke on Trent - UK
Posts: 1,728

Rep: 284 OrphanShadow is a proven memberOrphanShadow is a proven memberOrphanShadow is a proven member
Unique Rep: 217
Trader Rating: 0
Default

Quote:
Originally Posted by dharmaBum View Post
I'm a bit rusty on this, but I believe .NET has an MD5 class...here it is.

Using this class seems to me to be what you're trying to do.(though I admit I'm a bit of a idiot when it comes to stuff like this).

I did something like this for a ASP.NET site I did work on. It was simple enough to implement as I recall. I was using a SQL database to store the MD5 hash and using the class methods to read it back when required.
That wasn't quite what I was going for, but its given me a few ideas for my code

I basically straight-ported the VB6 code I had from college to .NET form and got this:

Code:
Public Class frmLive

    Dim prfAdm As Profile

    Private Sub frmLive_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        btnAcc.Text = "Go!"
        btnAcc.BackColor = Color.LimeGreen
        btnExt.Text = "Exit"
        btnExt.BackColor = Color.Red

        lblUsr.Text = "User ID"
        lblPsw.Text = "Passcode"

        Me.Text = "LiveWire DBSys"
    End Sub


    Private Sub btnAcc_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnAcc.Click
        Dim passcheck, usercheck As String
        Dim MemoryLoc As Integer


        usercheck = Trim(txtUsr.Text)

        If txtUsr.Text = "admin" Then
            If txtPsw.Text = "admin" Then
                AddUser()
            Else
                MsgBox("Wrong Admin Password")
                GoTo finish
            End If

        Else

            MemoryLoc = MemoryLocate(Mid(usercheck, 1, 8))

            FileOpen(1, "C:\psw.temp", OpenMode.Random, OpenAccess.ReadWrite, , Len(prfAdm))
            FileGet(1, prfAdm, MemoryLoc)
            passcheck = Trim(prfAdm.Password)
            FileClose(1)
            If passcheck = txtPsw.Text Then
                MsgBox("Welcome to LiveWire!")
            Else
                MsgBox("Login Failed. Try Again")
            End If
        End If

finish:


    End Sub


    Private Function MemoryLocate(ByVal usrname As String)
        Dim cconv(0 To usrname.Length - 1) As String
        Dim iCount = 1, asctotal As Integer

        For iCount = 1 To usrname.Length
            cconv(iCount - 1) = Asc(Mid(usrname, iCount, 1))
            asctotal += cconv(iCount - 1)
        Next

        MemoryLocate = asctotal Mod 197

    End Function

    Private Function AddUser()
        Dim username, password As String
        Dim MemoryLoc As Integer

        username = InputBox("Enter an Appropriate Username (8 Characters Max)")
        password = InputBox("Now, Enter a Password to the max of 8 Characters, text and numbers only!")

        MemoryLoc = MemoryLocate(username)

        FileOpen(1, "C:\psw.temp", OpenMode.Random, OpenAccess.ReadWrite, , Len(prfAdm))
        prfAdm.UserName = Trim(username)
        prfAdm.Password = Trim(password)

        FilePut(1, prfAdm, MemoryLoc)

        FileClose(1)

    End Function

    Private Sub btnExt_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnExt.Click
        MsgBox("Thank You For Using LiveWire!")
        Me.Close()
    End Sub
End Class
If you see any way of jamming an MD5 in there for security purposes, please let me know.

System: -[美しい悲劇]-
CPU
Atom N270 1.6Ghz
Motherboard
HP/Intel 945M
Memory
1GB DDR2 667Mhz
Graphics Card
Intel 945
Hard Drive
160GB 5400RPM
Sound Card
Realtek ALC885
Power Supply
External PSU
Case
HP Mini 110
CPU cooling
HeatPipe
GPU cooling
Heatpipe
OS
Windows 7 Pro x86
Monitor
10.1" Display
OrphanShadow is online now Overclocked Account OrphanShadow's Gallery   Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools



All times are GMT -5. The time now is 05:24 PM.


Overclock.net is a Carbon Neutral Site Creative Commons License

Terms of Service / Forum Rules | Privacy Policy | DMCA Info | Advertising | Become an Official Vendor
Copyright © 2009 Shogun Interactive Development. Most rights reserved.
Page generated in 0.11237 seconds with 8 queries