Why every TOTP app default uses SHA-1 hash encryption? - eviltoast

I use Aegis as my 2fa. Today on new token creation I observed that there’s hash function set to SHA-1, later checked all my tokens and the result is same type of encryption used for all. So I have edited all my tokens to SHA-256 as a result my totp doesn’t authenticate. Do I have to rescan my tokens for updating to SHA-256 or it doesn’t work like that?

Security: SHA-1 < SHA-256 < SHA-512

Speed: SHA-1 > SHA-256 > SHA-512

My doubts are: Why can’t we use SHA-256? Is it because TOTP requires less time so faster one(SHA-1) is chosen? Can we use SHA-256 for TOTPs?

  • refalo@programming.dev
    link
    fedilink
    arrow-up
    1
    ·
    edit-2
    6 months ago

    It’s up to every individual website to use whatever specific type of hash function they want, so absent of really technical users that know how to change the cipher, they all just default to SHA-1 for maximum compatibility.

    • m-p{3}@lemmy.ca
      link
      fedilink
      arrow-up
      1
      ·
      edit-2
      6 months ago

      And some TOTP apps don’t interpret the algorithm parameter correctly, which makes it safer to go with the default SHA-1.

      Lemmy in fact was using SHA-256 for its earlier TOTP implementation and reverted back to SHA-1 since some people locked themselves out due to poor support in some TOTP app (among other issues, another was that the activation workflow never asked you to confirm the code you enrolled was working and generating the correct code…).