Just take the string as bytes and hash it ffs

  • Saik0@lemmy.saik0.com
    link
    fedilink
    English
    arrow-up
    1
    ·
    30 days ago

    I sort of get it. You don’t want to allow the entire work of Shakespeare in the text field, even if your database can handle it.

    You don’t store the original text. You store the hash of it. If you SHA512 it, anything that’s ever given in the password field will always be 64Bytes.

    The only “legit” reason to restrict input to 16 character is if you’re using an encryption mechanism that just doesn’t support more characters as an input. However, if that’s the case, that’s a site I wouldn’t want to use to begin with if at all possible.

    • CosmicTurtle0@lemmy.dbzer0.com
      link
      fedilink
      English
      arrow-up
      1
      ·
      30 days ago

      I’ll admit I kind of typed this without thinking it through. In a secured site, the password would be hashed and salted before storing in the database.

      Depending on where you’re doing the hashing, long strings might still slow you down. That being said, from a security standpoint, any gain in entropy by adding characters would be negligible past a certain point. I don’t remember what that number is but it certainly isn’t in the thousands.

      • rain_worl@lemmy.world
        link
        fedilink
        English
        arrow-up
        1
        ·
        2 days ago

        you might compare 1,000 to 10,000, but more like 0.1% to 0.01%
        meaning of this? no. bad grammar.