4

As you may know, maximum input length for bcrypt is 72 characters and the output length is 60 characters. (I've it tested in PHP. Correct me if I'm wrong)

I want to know maximum input length and the exact output length for argon2. Thanks.

AliN11
  • 2,387
  • 1
  • 25
  • 40

1 Answers1

3

According to https://en.wikipedia.org/wiki/Argon2#Algorithm max input length is 2^32-1 bytes or 4294967295 bytes.

As to the equivalent in character length, it depends on what character encoding you use. According to this answer:

  • In ASCII or ISO 8859, each character is represented by one byte
  • In UTF-32, each character is represented by 4 bytes
  • In UTF-8, each character uses between 1 and 4 bytes
  • In ISO 2022, it's much more complicated

Still according to https://en.wikipedia.org/wiki/Argon2#Algorithm I cannot give you an 'exact' output length because it depends on the length you choose for various parameters such as the salt and the output hash itself.

CheddarLizzard
  • 471
  • 4
  • 10
  • 1
    The Wiki link shows that the output length of the algorithm is linearly proportional to the `tagLength` input, in bytes. Presumably, the OP will know which character encoding they're using, but it's likely that in most cases, it's UTF-8. – code_dredd Nov 02 '19 at 00:55
  • 1
    Looks like the most common safe max file size for input encoded in UTF-8 will be about 1 gigabyte, given 4.3 gigabyte divided by 4 ≈ 1.1 gigabyte. So more than enough for most use cases except video and multimedia contents. – Kebman Jul 26 '20 at 22:39
  • 1
    Note that the `argon2` command line tool [limits input to a maximum of 127 bytes](https://github.com/P-H-C/phc-winner-argon2/issues/339). – Matthias Braun Dec 30 '21 at 09:00