Announcement

Collapse
No announcement yet.

RE: Crypt Producting Consistant Results with NE Strings

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    RE: Crypt Producting Consistant Results with NE Strings



    ------=_NextPart_000_0000_01C51E82.87001B00
    Content-Type: text/plain;
    charset="us-ascii"
    Content-Transfer-Encoding: 7bit

    I accidently sent from my boss's email address ... however I found that
    CRYPT seems to be only encoding the first 8 characters of any string. It's
    too bad I didn't notice this earlier, is there anyway to work around it?

    My application would work best (it's a menu with order history) if each
    string sent had a unique counterpart. However, the menu is divided into
    categories and some categories have the same item. Example: Pizza,Sicilian;
    Pizza: Slices,Sicilian

    The string I am encrypted is setup "Category,Item,Extras,Amount;etc..." and
    represents one order for each item.

    Thanks,
    Andrew

    Orig. Message
    ----------------------------------

    Part of my application uses a crypt on a string to store it in a database,
    but I started to notice non-unique hashes coming from similar strings. Here
    are two strings that I tested and their resulting hash:

    <MvEVAL EXPR = "{'Pizza,Large Plain,,1;' CRYPT 'RD'}">
    <MvEVAL EXPR = "{'Pizza,Large White,,1;' CRYPT 'RD'}">

    RDNt2P.DhAVOA RDNt2P.DhAVOA

    Is there a problem with using spaces or semicolons? I don't want to change
    the salt or anything since I want to do lookups based on hashes.

    Thanks
    Andrew

    ------=_NextPart_000_0000_01C51E82.87001B00--

    #2
    RE: Crypt Producting Consistant Results with NE Strings



    Yes, CRYPT by definition uses only the first 8 characters for the hash. You
    can use the built-in crypto_md5() function (compiled Miva Script). If still
    working with uncompiled script, there is an MD5 function available on my
    website - in the resource section.

    Ivo
    http://mivo.truxoft.com


    -----Original Message-----
    From: Andrew Rosborough

    I accidently sent from my boss's email address ... however I found that
    CRYPT seems to be only encoding the first 8 characters of any string. It's
    too bad I didn't notice this earlier, is there anyway to work around it?

    My application would work best (it's a menu with order history) if each
    string sent had a unique counterpart. However, the menu is divided into
    categories and some categories have the same item. Example: Pizza,Sicilian;
    Pizza: Slices,Sicilian

    The string I am encrypted is setup "Category,Item,Extras,Amount;etc..." and
    represents one order for each item.

    Thanks,
    Andrew

    Orig. Message
    ----------------------------------

    Part of my application uses a crypt on a string to store it in a database,
    but I started to notice non-unique hashes coming from similar strings. Here
    are two strings that I tested and their resulting hash:

    <MvEVAL EXPR = "{'Pizza,Large Plain,,1;' CRYPT 'RD'}">
    <MvEVAL EXPR = "{'Pizza,Large White,,1;' CRYPT 'RD'}">

    RDNt2P.DhAVOA RDNt2P.DhAVOA

    Is there a problem with using spaces or semicolons? I don't want to change
    the salt or anything since I want to do lookups based on hashes.

    Thanks
    Andre


    Comment


      #3
      RE: Crypt Producting Consistant Results with NE Strings



      Does your md5 function have any limit to the number of characters that
      are used? I guess the string for an order could get really lengthy. If
      there is still a limit to how many characters are used, I would probably
      need to take a few characters spaced evenly apart from the string to
      make a new hashable string but this would be overly complicated.

      Thanks, I'll try setting up your script now and see how it works.
      Andrew

      On Wed, 2005-03-02 at 00:08 +0100, Ivo Truxa wrote:
      > Yes, CRYPT by definition uses only the first 8 characters for the hash. You
      > can use the built-in crypto_md5() function (compiled Miva Script). If still
      > working with uncompiled script, there is an MD5 function available on my
      > website - in the resource section.
      >
      > Ivo
      > http://mivo.truxoft.com
      >
      >
      > -----Original Message-----
      > From: Andrew Rosborough
      >
      > I accidently sent from my boss's email address ... however I found that
      > CRYPT seems to be only encoding the first 8 characters of any string. It's
      > too bad I didn't notice this earlier, is there anyway to work around it?
      >
      > My application would work best (it's a menu with order history) if each
      > string sent had a unique counterpart. However, the menu is divided into
      > categories and some categories have the same item. Example: Pizza,Sicilian;
      > Pizza: Slices,Sicilian
      >
      > The string I am encrypted is setup "Category,Item,Extras,Amount;etc..." and
      > represents one order for each item.
      >
      > Thanks,
      > Andrew
      >
      > Orig. Message
      > ----------------------------------
      >
      > Part of my application uses a crypt on a string to store it in a database,
      > but I started to notice non-unique hashes coming from similar strings. Here
      > are two strings that I tested and their resulting hash:
      >
      > <MvEVAL EXPR = "{'Pizza,Large Plain,,1;' CRYPT 'RD'}">
      > <MvEVAL EXPR = "{'Pizza,Large White,,1;' CRYPT 'RD'}">
      >
      > RDNt2P.DhAVOA RDNt2P.DhAVOA
      >
      > Is there a problem with using spaces or semicolons? I don't want to change
      > the salt or anything since I want to do lookups based on hashes.
      >
      > Thanks
      > Andre
      >
      >

      Comment


        #4
        RE: Crypt Producting Consistant Results with NE Strings



        I answered my last question by looking on your website where it says
        that the md5 function handles any data length. However when I load
        md5.mv, after a few uses of the test form it returns ffffffffffffff and
        sometimes 0000000000000000. I'll keep looking and try to find out why.

        Andrew

        On Tue, 2005-03-01 at 19:45 -0500, Andrew Rosborough wrote:
        > Does your md5 function have any limit to the number of characters that
        > are used? I guess the string for an order could get really lengthy. If
        > there is still a limit to how many characters are used, I would probably
        > need to take a few characters spaced evenly apart from the string to
        > make a new hashable string but this would be overly complicated.
        >
        > Thanks, I'll try setting up your script now and see how it works.
        > Andrew
        >
        > On Wed, 2005-03-02 at 00:08 +0100, Ivo Truxa wrote:
        > > Yes, CRYPT by definition uses only the first 8 characters for the hash. You
        > > can use the built-in crypto_md5() function (compiled Miva Script). If still
        > > working with uncompiled script, there is an MD5 function available on my
        > > website - in the resource section.
        > >
        > > Ivo
        > > http://mivo.truxoft.com
        > >
        > >
        > > -----Original Message-----
        > > From: Andrew Rosborough
        > >
        > > I accidently sent from my boss's email address ... however I found that
        > > CRYPT seems to be only encoding the first 8 characters of any string. It's
        > > too bad I didn't notice this earlier, is there anyway to work around it?
        > >
        > > My application would work best (it's a menu with order history) if each
        > > string sent had a unique counterpart. However, the menu is divided into
        > > categories and some categories have the same item. Example: Pizza,Sicilian;
        > > Pizza: Slices,Sicilian
        > >
        > > The string I am encrypted is setup "Category,Item,Extras,Amount;etc..." and
        > > represents one order for each item.
        > >
        > > Thanks,
        > > Andrew
        > >
        > > Orig. Message
        > > ----------------------------------
        > >
        > > Part of my application uses a crypt on a string to store it in a database,
        > > but I started to notice non-unique hashes coming from similar strings. Here
        > > are two strings that I tested and their resulting hash:
        > >
        > > <MvEVAL EXPR = "{'Pizza,Large Plain,,1;' CRYPT 'RD'}">
        > > <MvEVAL EXPR = "{'Pizza,Large White,,1;' CRYPT 'RD'}">
        > >
        > > RDNt2P.DhAVOA RDNt2P.DhAVOA
        > >
        > > Is there a problem with using spaces or semicolons? I don't want to change
        > > the salt or anything since I want to do lookups based on hashes.
        > >
        > > Thanks
        > > Andre
        > >
        > >

        Comment


          #5
          RE: Crypt Producting Consistant Results with NE Strings



          No, MD5 has no designed limits - it is commonly used for making hashes over
          entire files or directories. Just keep on mind that this Miva script
          function is interpreted and Miva Script is not well suite for binary and
          hexadecimal operations, hence it is rather slow for use on files. Tens or
          hundreds of characters should not be of a problem, though.

          Ivo
          http://mivo.truxoft.com


          -----Original Message-----
          From: Andrew Rosborough [mailto:[email protected]]
          Sent: Wednesday, March 02, 2005 1:45 AM
          To: Ivo Truxa
          Cc: [email protected]
          Subject: RE: [meu] RE: Crypt Producting Consistant Results with NE Strings

          Does your md5 function have any limit to the number of characters that
          are used? I guess the string for an order could get really lengthy. If
          there is still a limit to how many characters are used, I would probably
          need to take a few characters spaced evenly apart from the string to
          make a new hashable string but this would be overly complicated.

          Thanks, I'll try setting up your script now and see how it works.
          Andrew

          On Wed, 2005-03-02 at 00:08 +0100, Ivo Truxa wrote:
          > Yes, CRYPT by definition uses only the first 8 characters for the hash.
          You
          > can use the built-in crypto_md5() function (compiled Miva Script). If
          still
          > working with uncompiled script, there is an MD5 function available on my
          > website - in the resource section.
          >
          > Ivo
          > http://mivo.truxoft.com
          >
          >
          > -----Original Message-----
          > From: Andrew Rosborough
          >
          > I accidently sent from my boss's email address ... however I found that
          > CRYPT seems to be only encoding the first 8 characters of any string.
          It's
          > too bad I didn't notice this earlier, is there anyway to work around it?
          >
          > My application would work best (it's a menu with order history) if each
          > string sent had a unique counterpart. However, the menu is divided into
          > categories and some categories have the same item. Example:
          Pizza,Sicilian;
          > Pizza: Slices,Sicilian
          >
          > The string I am encrypted is setup "Category,Item,Extras,Amount;etc..."
          and
          > represents one order for each item.
          >
          > Thanks,
          > Andrew
          >
          > Orig. Message
          > ----------------------------------
          >
          > Part of my application uses a crypt on a string to store it in a database,
          > but I started to notice non-unique hashes coming from similar strings.
          Here
          > are two strings that I tested and their resulting hash:
          >
          > <MvEVAL EXPR = "{'Pizza,Large Plain,,1;' CRYPT 'RD'}">
          > <MvEVAL EXPR = "{'Pizza,Large White,,1;' CRYPT 'RD'}">
          >
          > RDNt2P.DhAVOA RDNt2P.DhAVOA
          >
          > Is there a problem with using spaces or semicolons? I don't want to
          change
          > the salt or anything since I want to do lookups based on hashes.
          >
          > Thanks
          > Andre


          Comment


            #6
            RE: Crypt Producting Consistant Results with NE Strings



            Thanks for helping me with this. It turns out it won't be hard to
            change the crypt function and make everything work again. The hardest
            part will be correctly calling the md5 script with MvDO.

            I tried <MvDO FILE="/miva/md5.mv" NAME="l.checksum" VALUE="{calcMD5('''
            $ l.completeorder $ ''')}"> but it is returning the same string each
            time.

            When I call the function, it rarely returns an actual hash. That's why
            I added apostrophe's. The script is running on earthlink servers Miva
            3.9408

            Andrew



            On Tue, 2005-03-01 at 19:57 -0500, Andrew Rosborough wrote:
            > I answered my last question by looking on your website where it says
            > that the md5 function handles any data length. However when I load
            > md5.mv, after a few uses of the test form it returns ffffffffffffff and
            > sometimes 0000000000000000. I'll keep looking and try to find out why.
            >
            > Andrew
            >
            > On Tue, 2005-03-01 at 19:45 -0500, Andrew Rosborough wrote:
            > > Does your md5 function have any limit to the number of characters that
            > > are used? I guess the string for an order could get really lengthy. If
            > > there is still a limit to how many characters are used, I would probably
            > > need to take a few characters spaced evenly apart from the string to
            > > make a new hashable string but this would be overly complicated.
            > >
            > > Thanks, I'll try setting up your script now and see how it works.
            > > Andrew
            > >
            > > On Wed, 2005-03-02 at 00:08 +0100, Ivo Truxa wrote:
            > > > Yes, CRYPT by definition uses only the first 8 characters for the hash. You
            > > > can use the built-in crypto_md5() function (compiled Miva Script). If still
            > > > working with uncompiled script, there is an MD5 function available on my
            > > > website - in the resource section.
            > > >
            > > > Ivo
            > > > http://mivo.truxoft.com
            > > >
            > > >
            > > > -----Original Message-----
            > > > From: Andrew Rosborough
            > > >
            > > > I accidently sent from my boss's email address ... however I found that
            > > > CRYPT seems to be only encoding the first 8 characters of any string. It's
            > > > too bad I didn't notice this earlier, is there anyway to work around it?
            > > >
            > > > My application would work best (it's a menu with order history) if each
            > > > string sent had a unique counterpart. However, the menu is divided into
            > > > categories and some categories have the same item. Example: Pizza,Sicilian;
            > > > Pizza: Slices,Sicilian
            > > >
            > > > The string I am encrypted is setup "Category,Item,Extras,Amount;etc..." and
            > > > represents one order for each item.
            > > >
            > > > Thanks,
            > > > Andrew
            > > >
            > > > Orig. Message
            > > > ----------------------------------
            > > >
            > > > Part of my application uses a crypt on a string to store it in a database,
            > > > but I started to notice non-unique hashes coming from similar strings. Here
            > > > are two strings that I tested and their resulting hash:
            > > >
            > > > <MvEVAL EXPR = "{'Pizza,Large Plain,,1;' CRYPT 'RD'}">
            > > > <MvEVAL EXPR = "{'Pizza,Large White,,1;' CRYPT 'RD'}">
            > > >
            > > > RDNt2P.DhAVOA RDNt2P.DhAVOA
            > > >
            > > > Is there a problem with using spaces or semicolons? I don't want to change
            > > > the salt or anything since I want to do lookups based on hashes.
            > > >
            > > > Thanks
            > > > Andre
            > > >
            > > >

            Comment


              #7
              RE: Crypt Producting Consistant Results with NE Strings



              Make sure you copied the plain-text version of the script as adviced at the
              top of the page, not the syntax-coloured one - that usually slightly differs
              due to the imperfection of the MvCALL parser. What strings give you result
              ffffffffffffff and 0000000000000?

              Ivo Truxa

              | http://miva.truxoft.com
              | Advanced Miva Merchant modules



              -----Original Message-----
              From: [email protected] [mailto:[email protected]] On Behalf
              Of Andrew Rosborough
              Sent: Wednesday, March 02, 2005 2:57 AM
              To: [email protected]
              Cc: [email protected]
              Subject: RE: [meu] RE: Crypt Producting Consistant Results with NE Strings

              Thanks for helping me with this. It turns out it won't be hard to
              change the crypt function and make everything work again. The hardest
              part will be correctly calling the md5 script with MvDO.

              I tried <MvDO FILE="/miva/md5.mv" NAME="l.checksum" VALUE="{calcMD5('''
              $ l.completeorder $ ''')}"> but it is returning the same string each
              time.

              When I call the function, it rarely returns an actual hash. That's why
              I added apostrophe's. The script is running on earthlink servers Miva
              3.9408

              Andrew



              On Tue, 2005-03-01 at 19:57 -0500, Andrew Rosborough wrote:
              > I answered my last question by looking on your website where it says
              > that the md5 function handles any data length. However when I load
              > md5.mv, after a few uses of the test form it returns ffffffffffffff and
              > sometimes 0000000000000000. I'll keep looking and try to find out why.
              >
              > Andrew
              >
              > On Tue, 2005-03-01 at 19:45 -0500, Andrew Rosborough wrote:
              > > Does your md5 function have any limit to the number of characters that
              > > are used? I guess the string for an order could get really lengthy. If
              > > there is still a limit to how many characters are used, I would probably
              > > need to take a few characters spaced evenly apart from the string to
              > > make a new hashable string but this would be overly complicated.
              > >
              > > Thanks, I'll try setting up your script now and see how it works.
              > > Andrew
              > >
              > > On Wed, 2005-03-02 at 00:08 +0100, Ivo Truxa wrote:
              > > > Yes, CRYPT by definition uses only the first 8 characters for the
              hash. You
              > > > can use the built-in crypto_md5() function (compiled Miva Script). If
              still
              > > > working with uncompiled script, there is an MD5 function available on
              my
              > > > website - in the resource section.
              > > >
              > > > Ivo
              > > > http://mivo.truxoft.com
              > > >
              > > >
              > > > -----Original Message-----
              > > > From: Andrew Rosborough
              > > >
              > > > I accidently sent from my boss's email address ... however I found
              that
              > > > CRYPT seems to be only encoding the first 8 characters of any string.
              It's
              > > > too bad I didn't notice this earlier, is there anyway to work around
              it?
              > > >
              > > > My application would work best (it's a menu with order history) if
              each
              > > > string sent had a unique counterpart. However, the menu is divided
              into
              > > > categories and some categories have the same item. Example:
              Pizza,Sicilian;
              > > > Pizza: Slices,Sicilian
              > > >
              > > > The string I am encrypted is setup
              "Category,Item,Extras,Amount;etc..." and
              > > > represents one order for each item.
              > > >
              > > > Thanks,
              > > > Andrew
              > > >
              > > > Orig. Message
              > > > ----------------------------------
              > > >
              > > > Part of my application uses a crypt on a string to store it in a
              database,
              > > > but I started to notice non-unique hashes coming from similar strings.
              Here
              > > > are two strings that I tested and their resulting hash:
              > > >
              > > > <MvEVAL EXPR = "{'Pizza,Large Plain,,1;' CRYPT 'RD'}">
              > > > <MvEVAL EXPR = "{'Pizza,Large White,,1;' CRYPT 'RD'}">
              > > >
              > > > RDNt2P.DhAVOA RDNt2P.DhAVOA
              > > >
              > > > Is there a problem with using spaces or semicolons? I don't want to
              change
              > > > the salt or anything since I want to do lookups based on hashes.
              > > >
              > > > Thanks
              > > > Andre


              Comment


                #8
                RE: Crypt Producting Consistant Results with NE Strings



                > Thanks for helping me with this. It turns out it won't be hard to
                > change the crypt function and make everything work again. The hardest
                > part will be correctly calling the md5 script with MvDO.
                >
                > I tried <MvDO FILE="/miva/md5.mv" NAME="l.checksum" VALUE="{calcMD5('''
                > $ l.completeorder $ ''')}"> but it is returning the same string each
                > time.

                Use <MvDO FILE="/miva/md5.mv" NAME="l.checksum"
                VALUE="{calcMD5(l.completeorder)}"> so that you aren't simply hashing the
                string constant 'l.completeorder'. I've been using Ivo's function for a
                couple of years without problems.

                > When I call the function, it rarely returns an actual hash. That's why
                > I added apostrophe's. The script is running on earthlink servers Miva
                > 3.9408
                >
                > Andrew
                >
                >
                >
                > On Tue, 2005-03-01 at 19:57 -0500, Andrew Rosborough wrote:
                >> I answered my last question by looking on your website where it says
                >> that the md5 function handles any data length. However when I load
                >> md5.mv, after a few uses of the test form it returns ffffffffffffff and
                >> sometimes 0000000000000000. I'll keep looking and try to find out why.
                >>
                >> Andrew
                >>
                >> On Tue, 2005-03-01 at 19:45 -0500, Andrew Rosborough wrote:
                >> > Does your md5 function have any limit to the number of characters that
                >> > are used? I guess the string for an order could get really lengthy.
                >> If
                >> > there is still a limit to how many characters are used, I would
                >> probably
                >> > need to take a few characters spaced evenly apart from the string to
                >> > make a new hashable string but this would be overly complicated.
                >> >
                >> > Thanks, I'll try setting up your script now and see how it works.
                >> > Andrew
                >> >
                >> > On Wed, 2005-03-02 at 00:08 +0100, Ivo Truxa wrote:
                >> > > Yes, CRYPT by definition uses only the first 8 characters for the
                >> hash. You
                >> > > can use the built-in crypto_md5() function (compiled Miva Script).
                >> If still
                >> > > working with uncompiled script, there is an MD5 function available
                >> on my
                >> > > website - in the resource section.
                >> > >
                >> > > Ivo
                >> > > http://mivo.truxoft.com
                >> > >
                >> > >
                >> > > -----Original Message-----
                >> > > From: Andrew Rosborough
                >> > >
                >> > > I accidently sent from my boss's email address ... however I found
                >> that
                >> > > CRYPT seems to be only encoding the first 8 characters of any
                >> string. It's
                >> > > too bad I didn't notice this earlier, is there anyway to work around
                >> it?
                >> > >
                >> > > My application would work best (it's a menu with order history) if
                >> each
                >> > > string sent had a unique counterpart. However, the menu is divided
                >> into
                >> > > categories and some categories have the same item. Example:
                >> Pizza,Sicilian;
                >> > > Pizza: Slices,Sicilian
                >> > >
                >> > > The string I am encrypted is setup
                >> "Category,Item,Extras,Amount;etc..." and
                >> > > represents one order for each item.
                >> > >
                >> > > Thanks,
                >> > > Andrew
                >> > >
                >> > > Orig. Message
                >> > > ----------------------------------
                >> > >
                >> > > Part of my application uses a crypt on a string to store it in a
                >> database,
                >> > > but I started to notice non-unique hashes coming from similar
                >> strings. Here
                >> > > are two strings that I tested and their resulting hash:
                >> > >
                >> > > <MvEVAL EXPR = "{'Pizza,Large Plain,,1;' CRYPT 'RD'}">
                >> > > <MvEVAL EXPR = "{'Pizza,Large White,,1;' CRYPT 'RD'}">
                >> > >
                >> > > RDNt2P.DhAVOA RDNt2P.DhAVOA
                >> > >
                >> > > Is there a problem with using spaces or semicolons? I don't want to
                >> change
                >> > > the salt or anything since I want to do lookups based on hashes.
                >> > >
                >> > > Thanks
                >> > > Andre
                >> > >
                >> > >

                Comment

                Working...
                X