• CocaineShrimp@sh.itjust.works
    link
    fedilink
    arrow-up
    116
    ·
    2 days ago

    It’s also a gigantic red flag when sites say there’s a password limit

    Bitch, my password is supposed to be hashed so even if I uploaded the LOTR trilogy extended edition in 4K, it should still come out the same length as any other SHA256 hash

    • Toes♀@ani.social
      link
      fedilink
      arrow-up
      24
      ·
      1 day ago

      I appreciate the enthusiasm but my load balancer will get sad if I let you send more than 1500 bytes.

      • u/lukmly013 💾 (lemmy.sdf.org)@lemmy.sdf.orgOP
        link
        fedilink
        arrow-up
        6
        arrow-down
        1
        ·
        1 day ago

        First round of hashing could be done client-side, and then send that to the server.
        Would be cool to also add salt so that the hash couldn’t get re-used across services even with the same source password/file if somehow captured.

        Idea:

        1. Enter username
        2. Server sends salt to client
        3. Enter password or key file
        4. Client computes hash of the password or file with salt added (I have no idea how it’s used. If appended, some hashing functions could truncate the data, losing the salt. If prepended along with truncation, you just made the password even shorter. XOR?)
        5. Client sends hash to server
        6. Server hashes the hash same way as if it was password
        7. If it matches, you’re in

        Basically, the hash is your password. Data can be whatever.
        Most websites already use JavaScript, so why not.

        • takeda@lemmy.dbzer0.com
          link
          fedilink
          arrow-up
          2
          ·
          11 hours ago

          You could write a browser extension that converts your password to a hash. You could pick the hash yourself so the server has no way to figure what the original password was.

          You would essentially achieve the same thing.

        • Toes♀@ani.social
          link
          fedilink
          arrow-up
          4
          arrow-down
          1
          ·
          edit-2
          20 hours ago

          So, I was having trouble sleeping last night and found myself mulling over your idea.

          As any good sleep deprived tech I went down a rabbit hole. There are solutions that prepare the encrypted payload on the client side. But, why you don’t see solutions offering you to authenticate with the entire lotr series is that you hit a ceiling really fast where more data is the same security threshold as the former smaller data.

          If you want to derive security from large data there’s already a scalable solution in the form of private public key pairs, where the size of the key is directly tied to the security. So if you convert lotr to a prime number you can get somewhere with that approach.

          • NiHaDuncan@lemmy.world
            link
            fedilink
            arrow-up
            2
            ·
            6 hours ago

            I’ve thought of the point where password length becomes irrelevant as well. Unless there some maths I don’t know that plays a role here, longer passwords become useless when x^n > K. Where x is the character set available for the password, n is the smallest length that meets the criteria of the formula, and K is the hash functions key space. Effectively, this would be due to the fact that brute forcing would be just as likely to find a collision as it would the actual password used.

        • Axolotl.cpp@lemmy.dbzer0.com
          link
          fedilink
          arrow-up
          4
          ·
          edit-2
          21 hours ago

          I’d rather not make the client do anything like that, you cannot trust a client, EVER; what if some script kiddie tries to send the clear passwd by modifyng the request? Ofc it’s a very minor problem but still…

            • Orygin@sh.itjust.works
              link
              fedilink
              arrow-up
              2
              ·
              edit-2
              20 hours ago

              I wouldn’t send the salt to the client. Have it hash the password, then the server hashes that with the salt for comparison and storage.
              But that would mean you can’t verify the password complexity server side, which can be bad for certain accounts.

              • u/lukmly013 💾 (lemmy.sdf.org)@lemmy.sdf.orgOP
                link
                fedilink
                arrow-up
                2
                arrow-down
                1
                ·
                20 hours ago

                If there would be an advantage to doing so, the server could still do that anyway. You’d just end up storing client salt and server salt.
                My main concern was MITM which doesn’t modify the webpage if web UI is used, such as on corporate networks which require client devices to have that network’s root certificate for scanning and activity logging.

                • Orygin@sh.itjust.works
                  link
                  fedilink
                  arrow-up
                  2
                  ·
                  14 hours ago

                  The client salt would need to be consistent and “public” since the client needs it before login. It’s basically useless.

        • pet the cat, walk the dog@lemmy.world
          link
          fedilink
          arrow-up
          3
          arrow-down
          1
          ·
          edit-2
          17 hours ago

          Basically, the hash is your password

          Exactly, this is equivalent to using a password of a particular length with only hex digits. It may be long, but the original data is completely unnecessary here.

          The salt adds nothing, since you can’t change it, as you need to produce the stored hash in the end on the server. There are methods of challenge-response authentication wherein the server sends a random challenge and the client hashes it, but that requires storing the password in cleartext on the server.

          • u/lukmly013 💾 (lemmy.sdf.org)@lemmy.sdf.orgOP
            link
            fedilink
            arrow-up
            2
            arrow-down
            1
            ·
            16 hours ago

            The salt adds nothing

            It prevents cross-service re-use, should the original password hash be obtained (if other services used the same system).

            Example (MD5 in b64 used for simplicity): Same password is used on website1 and website2. The password is password.
            password produces KGdV+tBIacpSMyCszg3GpA== which can be used for both websites.
            Now, if website1 adds sbo2 as salt, and website2 addsx3e5, you get:
            passwordsbo2 -> d0bd511zpYqG3//3vLGYRQ==
            passwordx3e5 -> 788BnQKx7B2KOSju2jviiQ==

            So if you are on a corporate network that does MITM (you had to add their root cert) for monitoring, they’ll only see a hash for each website separately, without being able to re-use it.
            Though that’s quite a bit of an edge case, and assumes no client modification or other monitoring.

            • pet the cat, walk the dog@lemmy.world
              link
              fedilink
              arrow-up
              2
              ·
              15 hours ago

              True, I got engrossed in thinking through your proposal and forgotten about the original intent of a salt. Happens to me from time to time, particularly with security topics for some reason.

        • pet the cat, walk the dog@lemmy.world
          link
          fedilink
          arrow-up
          2
          ·
          20 hours ago

          If you mean that as sarcasm, there are multiple calculations of the complexity of such a password, in which it performs no worse than a random password of a typical length. Although for myself I still prefer random passwords stored in a password manager, with extra special characters and quite some reserve in length.

          • Axolotl.cpp@lemmy.dbzer0.com
            link
            fedilink
            arrow-up
            2
            ·
            19 hours ago

            Nah, it was not sarcasm, i’d use them myself if i wasn’t lazy, i just make my password manager generate and store the password