Converting passwords (Normal -> Md5)

Results 1 to 12 of 12
  1. #1
    Account Upgraded | Title Enabled! themad is offline
    MemberRank
    Dec 2004 Join Date
    BulgariaLocation
    1,018Posts

    Converting passwords (Normal -> Md5)


    Changing all the passwords of all accounts in your server store method.
    [normal to md5]



    Currently there are two types of JoinServers released. One that works with MD5 hashed passwords and one that works with normal alphanumeric passwords. Since its not possible to convert a md5 hash to its original varchar string, I am going to explain how to make it the other way around.
    Quote Originally Posted by What is MD5?
    In cryptography, MD5 (Message-Digest algorithm 5) is a widely-used cryptographic hash function with a 128-bit hash value. As an Internet standard (RFC 1321), MD5 has been employed in a wide variety of security applications, and is also commonly used to check the integrity of files.

    Why do people use MD5 hashed passwords?
    - Hell should i know ? They just do, usually its required for security measures, in case 'the big bad hacker' sneaks by the back door and gets into your database, but little does he know that you use md5 and he can't leech any useful info:harhar:.
    -------------
    Why the hell did i created this guide? (Sup, don't this guy have better things to do?)
    - You are reading it so....

    Here we go.. Open the MSSQL Query Analyzer
    1. We make sure that we have the WZ_MD5_MOD.dll in the /Tools/Binn/ directory of our Microsoft SQL Server.
    2. Creating the Extended md5 Stored Procedures to the Master DB
      Code:
      use Master
      GO
      if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[XP_MD5_CheckValue]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
      drop procedure [dbo].[XP_MD5_CheckValue]
      GO
      
      SET QUOTED_IDENTIFIER OFF 
      GO
      SET ANSI_NULLS OFF 
      GO
      
      exec sp_addextendedproc N'XP_MD5_CheckValue', N'WZ_MD5_MOD.dll'
      GO
      SET QUOTED_IDENTIFIER OFF 
      GO
      SET ANSI_NULLS ON 
      GO
      
      if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[XP_MD5_EncodeKeyVal]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
      drop procedure [dbo].[XP_MD5_EncodeKeyVal]
      GO
      
      SET QUOTED_IDENTIFIER OFF 
      GO
      SET ANSI_NULLS OFF 
      GO
      
      exec sp_addextendedproc N'XP_MD5_EncodeKeyVal', N'WZ_MD5_MOD.dll'
      GO
      SET QUOTED_IDENTIFIER OFF 
      GO
      SET ANSI_NULLS ON 
      GO
    3. Backup your database. If you mess it up i'll never hear the end of it!
    4. Now we create a field in the MEMB_INFO table to store passwords in (temporary)
      Code:
      use MuOnline
      alter table memb_info add temphash varbinary(17);
    5. The key function that will make our dreams come true ^^ (haven't tested it..wrote it here)
      Code:
      DECLARE @hash binary(16),
          @myvarpass varchar(10),
          @accid    varchar(10);
      DECLARE mytest SCROLL CURSOR FOR SELECT memb___id,memb__pwd FROM MEMB_INFO
      OPEN mytest
      FETCH NEXT FROM mytest INTO @accid, @myvarpass;
      while (@@fetch_status = 0) BEGIN
          EXEC master..XP_MD5_EncodeKeyVal @myvarpass, @accid, @hash OUT;
          UPDATE MEMB_INFO SET temphash = @hash WHERE memb___id = @accid;
          FETCH NEXT FROM mytest INTO @accid, @myvarpass;
      END
      CLOSE mytest
      DEALLOCATE mytest
    6. Now lets change the type of the memb__pwd column.
      Code:
      alter table memb_info drop column memb__pwd;
      alter table memb_info add memb__pwd varbinary(17);
    7. And now for the coup de grace.
      Code:
      update memb_info set memb__pwd=temphash;
      alter table memb_info drop column temphash;
    8. Sup? I want answers !

    I get all the credits for this cuz i'm a greedy MOFO. Sue me !!

    p.s. got l33t ?
    Last edited by themad; 02-06-07 at 12:20 AM.


  2. #2
    I'll take you all on. Liselotte is offline
    MemberRank
    May 2004 Join Date
    Sector 7Location
    5,800Posts

    Re: [Guide] Converting passwords (Normal -> Md5)

    hmm im on step five, when i execute the query, it gives me this error:
    Disallowed implicit conversion from data type varchar to data type varbinary, table 'MuOnline.dbo.MEMB_INFO', column 'memb__pwd'. Use the CONVERT function to run this query.
    any idea?

    Edit:
    nvm, i got it working. on the last step, i have this:
    (644 row(s) affected)

    Server: Msg 3728, Level 16, State 1, Line 2
    'temphash' is not a constraint.
    Server: Msg 3727, Level 16, State 1, Line 2
    Could not drop constraint. See previous errors.
    well the query is working but dont know the last 2 errors.

  3. #3
    Account Upgraded | Title Enabled! themad is offline
    MemberRank
    Dec 2004 Join Date
    BulgariaLocation
    1,018Posts

    Re: [Guide] Converting passwords (Normal -> Md5)

    Quote Originally Posted by liselotte View Post
    hmm im on step five, when i execute the query, it gives me this error:


    any idea?

    Edit:
    nvm, i got it working. on the last step, i have this:


    well the query is working but dont know the last 2 errors.
    yea..happens..btw you shouldn't have continues this way..but i guess if its working there is np..
    updated and fixed it..leaving this guide :)

  4. #4
    I'll take you all on. Liselotte is offline
    MemberRank
    May 2004 Join Date
    Sector 7Location
    5,800Posts

    Re: [Guide] Converting passwords (Normal -> Md5)

    ok, well its working 100%. thanks man, really need it. Sex? ^^

  5. #5
    Apprentice gordon_ak47 is offline
    MemberRank
    Sep 2006 Join Date
    Romania Baia mareLocation
    12Posts

    Re: [Guide] Converting passwords (Normal -> Md5)

    Warning: mssql_query(): message: Disallowed implicit conversion from data type varchar to data type varbinary, table 'MuOnline.dbo.MEMB_INFO', column 'memb__pwd'. Use the CONVERT function to run this query. (severity 16) in D:\AppServ\www\modules\doreg.php on line 196

    What i need to do?

  6. #6
    Apprentice gordon_ak47 is offline
    MemberRank
    Sep 2006 Join Date
    Romania Baia mareLocation
    12Posts

    Re: [Guide] Converting passwords (Normal -> Md5)

    nice work i don't know what doing this query but is Work. I have md5 in mssql and the server is md5 too but on site with this query still working the registration :) THX

  7. #7
    Account Upgraded | Title Enabled! themad is offline
    MemberRank
    Dec 2004 Join Date
    BulgariaLocation
    1,018Posts

    Re: [Guide] Converting passwords (Normal -> Md5)

    Quote Originally Posted by gordon_ak47 View Post
    Warning: mssql_query(): message: Disallowed implicit conversion from data type varchar to data type varbinary, table 'MuOnline.dbo.MEMB_INFO', column 'memb__pwd'. Use the CONVERT function to run this query. (severity 16) in D:\AppServ\www\modules\doreg.php on line 196

    What i need to do?
    well..to find a web that supports MD5 hashed passwords and use it. :)

  8. #8
    Member scoobydxb is offline
    MemberRank
    Jul 2007 Join Date
    63Posts

    Re: [Guide] Converting passwords (Normal -> Md5)

    I have made followed ur guide and really worked. Great Guide.

    Question, now that i have an MD5 password for all the accounts, how will i be able to migrate these accounts to a 1.00.16 DB that has Me_Muonline.bak

  9. #9
    C# My Life thepatan55 is offline
    MemberRank
    Oct 2007 Join Date
    Julin, Fujian,Location
    308Posts

    Re: [Guide] Converting passwords (Normal -> Md5)

    Exlente I worked with the web
    Mu web 0.9
    but the login I have to try twice to enter

    MEMB_INFO:
    add in table
    temphash varbinary(17)

    and query analyzer in db MuOnline

    update memb_info set memb__pwd=temphash;
    alter table memb_info drop column temphash;


    SP_MD5_ENCODE_VALUE
    edit

    CREATE PROCEDURE SP_MD5_ENCODE_VALUE

    @btInStr varchar(10),
    @btInStrIndex varchar(10)
    AS
    BEGIN
    DECLARE mytest SCROLL CURSOR FOR SELECT memb___id,memb__pwd FROM MEMB_INFO
    DECLARE @btOutVal BINARY(16)
    OPEN mytest
    EXEC master..XP_MD5_EncodeKeyVal @btInStr, @btInStrIndex, @btOutVal OUT
    UPDATE MEMB_INFO SET temphash = @btOutVal WHERE memb___id = @btInStrIndex
    FETCH NEXT FROM mytest INTO @btInStrIndex, @btInStr;

    END
    GO
    Last edited by thepatan55; 01-11-09 at 05:19 AM. Reason: add more info

  10. #10

    Re: [Guide] Converting passwords (Normal -> Md5)

    Quote Originally Posted by gordon_ak47 View Post
    Warning: mssql_query(): message: Disallowed implicit conversion from data type varchar to data type varbinary, table 'MuOnline.dbo.MEMB_INFO', column 'memb__pwd'. Use the CONVERT function to run this query. (severity 16) in D:\AppServ\www\modules\doreg.php on line 196

    What i need to do?
    You just have to go into Enterprise Manager, open the MuOnline database, right click on MEMB_INFO table, click Design table and where you see the line
    memb__pwd, change the value "varbinary" to "varchar", then close the window. It'll ask for save, choose yes, of course. :D

  11. #11
    Enthusiast pitic is offline
    MemberRank
    Nov 2009 Join Date
    27Posts

    Re: [Guide] Converting passwords (Normal -> Md5)

    i want an tutorial about Converting passwords (Normal -> Md5)

    with all passes :) please

  12. #12
    Member barry952 is offline
    MemberRank
    Oct 2008 Join Date
    71Posts

    Re: [Guide] Converting passwords (Normal -> Md5)

    Worked 100 percent..thx dude



Advertisement