Encrypting a table column

  • hi, i've been requested to encrypt a password column in a table on our database. This is the first time i'm venturing into encryption and im doing lots of reading work, problem is i dont understand the whole thing and i need to have a release out asap. can anyone help me out with a script to encrypt the password column in the following table. thanks guys...

    DECLARE @AppPasswords TABLE(PasswordID INT IDENTITY(1,1), UserID INT, Password VARCHAR(50), PwdDateCreated DATETIME)

    INSERT INTO @AppPasswords (

    [UserID],

    [Password],

    [PwdDateCreated]

    ) VALUES (

    1,

    'fakepassword',

    '2008-11-24 10:16:44.461' )

    SELECT * FROM @AppPasswords

  • mmm, looks like hashing the column is the preferred method...

    any advice and code examples?

  • no worries people. i found a solution.

    :w00t:

  • Care to post up your solution in case anyone else sees this thread and has a similar question?

    __________________________________________________

    Against stupidity the gods themselves contend in vain. -- Friedrich Schiller
    Stop, children, what's that sound? Everybody look what's going down. -- Stephen Stills

  • DECLARE @AppPasswords TABLE(PasswordID INT IDENTITY(1,1), UserID INT, Password VARCHAR(50), PwdDateCreated DATETIME)

    INSERT INTO @AppPasswords (

    [UserID],

    [Password],

    [PwdDateCreated]

    ) VALUES (

    1,

    HashBytes('MD5', 'fakepassword'),

    '2008-11-24 10:16:44.461' )

    SELECT * FROM @AppPasswords

    IF EXISTS (SELECT * FROM @AppPasswords WHERE

    [UserID] = 1 AND [Password] =

    HashBytes('MD5', 'fakepassword'))

    BEGIN

    SELECT 'Password Matched'

    END

    ELSE

    BEGIN

    SELECT 'Password Did Not Match'

    END

    SELECT * FROM [@AppPasswords]

  • Thanks 😉

    __________________________________________________

    Against stupidity the gods themselves contend in vain. -- Friedrich Schiller
    Stop, children, what's that sound? Everybody look what's going down. -- Stephen Stills

Viewing 6 posts - 1 through 5 (of 5 total)

You must be logged in to reply to this topic. Login to reply