MD5 encrypt a list of password from a file

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Declan Barry

    #1

    MD5 encrypt a list of password from a file

    Hi all..

    Does anyone have a php script that would allow me to encrypt the
    contents of a txt file?

    I have an excel file which has a list of usernames and generated
    passwords. What I would like to do is copy out the plaintext
    passwords to a txt file and then do a conversion to encrypt the
    passwords using MD5 encryption as they will then be imported into a
    MySQL database.

    Is that possible?

    I can do them one at a time using a small php script but I've approx
    100+ to do.

    Regards

    Declan Barry
  • Jerry Stuckle

    #2
    Re: MD5 encrypt a list of password from a file

    Declan Barry wrote:[color=blue]
    > Hi all..
    >
    > Does anyone have a php script that would allow me to encrypt the
    > contents of a txt file?
    >
    > I have an excel file which has a list of usernames and generated
    > passwords. What I would like to do is copy out the plaintext
    > passwords to a txt file and then do a conversion to encrypt the
    > passwords using MD5 encryption as they will then be imported into a
    > MySQL database.
    >
    > Is that possible?
    >
    > I can do them one at a time using a small php script but I've approx
    > 100+ to do.
    >
    > Regards
    >
    > Declan Barry[/color]

    I wouldn't even write code for it. Just export the data to CSV, import
    it into MySQL and do it from there.

    For instance, if your excel file has

    userid password

    Create three columns in your table - uid, temppw and pw. Export the
    Excel file as CSV format and load it into the table. Then simply update
    the table, setting pw to MD5(temppw).

    The just drop the temppw column.

    No programming required.

    --
    =============== ===
    Remove the "x" from my email address
    Jerry Stuckle
    JDS Computer Training Corp.
    jstucklex@attgl obal.net
    =============== ===

    Comment

    • Nicholas Sherlock

      #3
      Re: MD5 encrypt a list of password from a file

      Declan Barry wrote:[color=blue]
      > Does anyone have a php script that would allow me to encrypt the
      > contents of a txt file?[/color]

      Note that MD5 is not encryption. It is a hash that irreversibly
      transforms input into a small (8 byte?) value.

      Cheers,
      Nicholas Sherlock

      Comment

      • Jasen Betts

        #4
        Re: MD5 encrypt a list of password from a file

        On 2006-02-08, Declan Barry <dpbarry@barryw eb.co.uk> wrote:[color=blue]
        > Hi all..
        >
        > Does anyone have a php script that would allow me to encrypt the
        > contents of a txt file?
        >
        > I have an excel file which has a list of usernames and generated
        > passwords. What I would like to do is copy out the plaintext
        > passwords to a txt file and then do a conversion to encrypt the
        > passwords using MD5 encryption as they will then be imported into a
        > MySQL database.
        >
        > Is that possible?
        >[/color]
        [color=blue]
        > I can do them one at a time using a small php script but I've approx
        > 100+ to do.[/color]

        php has loops... past them into an array in your script ...


        Bye.
        Jasen

        Comment

        • Bandit

          #5
          Re: MD5 encrypt a list of password from a file

          Hi Jerry..

          Thanks for that. I later discovered that on another website but I
          also found a VBA macro that I was able to plug into excel to do the
          same way. Mind you, the method you described sounds easier.

          One query though. What happens if you already had some password data
          in there in the first place. Does it get encrypted (.Sorry.. Hashed)
          again thus making the original hash totally whacked out?

          Declan

          On Wed, 08 Feb 2006 16:53:20 -0500, Jerry Stuckle
          <jstucklex@attg lobal.net> wrote:
          [color=blue]
          >Declan Barry wrote:[color=green]
          >> Hi all..
          >>
          >> Does anyone have a php script that would allow me to encrypt the
          >> contents of a txt file?
          >>
          >> I have an excel file which has a list of usernames and generated
          >> passwords. What I would like to do is copy out the plaintext
          >> passwords to a txt file and then do a conversion to encrypt the
          >> passwords using MD5 encryption as they will then be imported into a
          >> MySQL database.
          >>
          >> Is that possible?
          >>
          >> I can do them one at a time using a small php script but I've approx
          >> 100+ to do.
          >>
          >> Regards
          >>
          >> Declan Barry[/color]
          >
          >I wouldn't even write code for it. Just export the data to CSV, import
          >it into MySQL and do it from there.
          >
          >For instance, if your excel file has
          >
          > userid password
          >
          >Create three columns in your table - uid, temppw and pw. Export the
          >Excel file as CSV format and load it into the table. Then simply update
          >the table, setting pw to MD5(temppw).
          >
          >The just drop the temppw column.
          >
          >No programming required.[/color]

          Comment

          • Bandit

            #6
            Re: MD5 encrypt a list of password from a file

            Hi Nicholas..

            Thanks for that. I gathered initially that I was using the phrase
            incorrectly but thought I'd use it to describe it in its simplistic
            form.

            What is the difference actually?

            Declan

            On Thu, 09 Feb 2006 13:14:19 +1300, Nicholas Sherlock
            <N.sherlock@gma il.com> wrote:
            [color=blue]
            >Declan Barry wrote:[color=green]
            >> Does anyone have a php script that would allow me to encrypt the
            >> contents of a txt file?[/color]
            >
            >Note that MD5 is not encryption. It is a hash that irreversibly
            >transforms input into a small (8 byte?) value.
            >
            >Cheers,
            >Nicholas Sherlock[/color]

            Comment

            • Jerry Stuckle

              #7
              Re: MD5 encrypt a list of password from a file

              Bandit wrote:[color=blue]
              > Hi Jerry..
              >
              > Thanks for that. I later discovered that on another website but I
              > also found a VBA macro that I was able to plug into excel to do the
              > same way. Mind you, the method you described sounds easier.
              >
              > One query though. What happens if you already had some password data
              > in there in the first place. Does it get encrypted (.Sorry.. Hashed)
              > again thus making the original hash totally whacked out?
              >
              > Declan
              >
              > On Wed, 08 Feb 2006 16:53:20 -0500, Jerry Stuckle
              > <jstucklex@attg lobal.net> wrote:
              >
              >[/color]

              Yes, in this means it would be hashed again.

              If all the passwords are hashed, just don't do the MD5 step. If none of
              them are hashed, you need to do the MD5 step.

              But if some of them are hashed and some not, you'll have to examine each
              record individually and hash those which aren't.

              Or, if you have two password columns in your Excel table (one plain, one
              hashed), you could just hash them for those which aren't already hashed
              (i.e. hashed pw length = 0).

              --
              =============== ===
              Remove the "x" from my email address
              Jerry Stuckle
              JDS Computer Training Corp.
              jstucklex@attgl obal.net
              =============== ===

              Comment

              • Jerry Stuckle

                #8
                Re: MD5 encrypt a list of password from a file

                Bandit wrote:[color=blue]
                > Hi Nicholas..
                >
                > Thanks for that. I gathered initially that I was using the phrase
                > incorrectly but thought I'd use it to describe it in its simplistic
                > form.
                >
                > What is the difference actually?
                >
                > Declan
                >[/color]
                Declan,

                Encryption can be always be reversed (decrypted). Hashing generally cannot.

                Also, please don't top post. Thanks.

                --
                =============== ===
                Remove the "x" from my email address
                Jerry Stuckle
                JDS Computer Training Corp.
                jstucklex@attgl obal.net
                =============== ===

                Comment

                • Jim Michaels

                  #9
                  Re: MD5 encrypt a list of password from a file


                  "Jerry Stuckle" <jstucklex@attg lobal.net> wrote in message
                  news:x56dnZgdX4 HI9XfenZ2dnUVZ_ tadnZ2d@comcast .com...[color=blue]
                  > Declan Barry wrote:[color=green]
                  >> Hi all..
                  >>
                  >> Does anyone have a php script that would allow me to encrypt the
                  >> contents of a txt file?
                  >>
                  >> I have an excel file which has a list of usernames and generated
                  >> passwords. What I would like to do is copy out the plaintext
                  >> passwords to a txt file and then do a conversion to encrypt the
                  >> passwords using MD5 encryption as they will then be imported into a
                  >> MySQL database.
                  >>
                  >> Is that possible?
                  >>
                  >> I can do them one at a time using a small php script but I've approx
                  >> 100+ to do.
                  >>
                  >> Regards
                  >>
                  >> Declan Barry[/color]
                  >
                  > I wouldn't even write code for it. Just export the data to CSV, import it
                  > into MySQL and do it from there.
                  >
                  > For instance, if your excel file has
                  >
                  > userid password
                  >
                  > Create three columns in your table - uid, temppw and pw. Export the Excel
                  > file as CSV format and load it into the table. Then simply update the
                  > table, setting pw to MD5(temppw).[/color]

                  one thing that will make your passwords harder to crack is by prepending and
                  appending some fixed string to the password in question before feeding it to
                  MD5()
                  like MD5("hornswigl{ $password}fizzl eblat")
                  when you go to compare passwords, you of course need to use the same thing
                  on one side to compare with your db.
                  [color=blue]
                  >
                  > The just drop the temppw column.
                  >
                  > No programming required.
                  >
                  > --
                  > =============== ===
                  > Remove the "x" from my email address
                  > Jerry Stuckle
                  > JDS Computer Training Corp.
                  > jstucklex@attgl obal.net
                  > =============== ===[/color]


                  Comment

                  Working...