Skip to content
Aetherinox edited this page Feb 7, 2024 · 6 revisions

Argon 2

Argon2

Version Downloads Repo Size Last Commit) Hits







About

xSum's primary intended purpose is to create an application which includes a large variety of cryptographic hash functions in order to generate hash tables / digests for your released projects.

On top of xSum generating hash tables for your application, it also has the ability to hash strings.

xSum has been designed to accept one of three types of input:

  • File Location
  • Folder Location
  • String (Text)

If xSum detects your input as a string which is not a valid folder or file, it will output the hash associated to that string.

Hashing functions such as SHA, CRC, Blake, and MD5 are known as Cryptographic Hash Functions. These are checksums which protect against malicious changes to a file.

Argon2 on the other hand is known as a Key Derivation Function, which is a memory-hard password hashing function that can be used to hash passwords for credential storage, key derivation, or other applications.

Argon2 has become popular thanks to programs like KeePassXC and Bitwarden, which are popular Password Managers. Argon2 belongs in the same category as PBKDF2 and Scrypt.

The following is a list of functions broken up by categories:


Cryptographic Hash Functions

These are utilized by xSum to create hashes for files, folders, and strings which will be used to create a hash digest.


Algorithm Sizes
MD2, MD4, MD5
SHA-0
SHA-1
SHA-2 224, 256, 384, 512, 512-224, 512-256
SHA-3 128, 224, 256, 384, 512
GOST 34.11-94
GOST R 34.11-2012 [Streebog] 256, 512
RIPEMD 128, 256, 256, 320
Blake2B 160, 256, 384, 512
Blake2S 128, 160, 224, 256
Blake2BP
Blake2SP
Blake3
Keccak 224, 256, 288, 384, 512

Key Derivation Functions

These are used by xSum for string hashing only, not for creating file hash digests.


Algorithm Variants
PBKDF2
Argon2 2i, 2d, 2id
Scrypt



Hashing Strings

To perform a string hash, simply enter a string value in your command where you'd normally input a file or folder. After executing the command, xSum will ensure that no file or folder exists, and then switch over to String Mode.





Using Argon2

To utilize Argon2 in the same fashion as explained above in the section Hashing Strings, specify --algo argon2 as your desired hash function.

For our example, we will run

xsum --generate "This is my string" --algo argon2


Additional Parameters

There are numerous parameters you can specify when hashing a password with Argon2. The following is a summary of what makes up Argon2:

Parameter Abbrev. Min / Max Size Usage
Password P 0 -> 2^32 - 1 Password or message to be hashed
Salt S 8 -> 2^32 - 1 The salt to use with hashing password or message (recommend 16 bytes)
Parallelism p 1 -> 2^24 - 1 Number of threads to use
Tag / Hash Length T 4 -> 2^32 - 1 Desired length of returned hash
Memory Size m 8 -> 2^32 - 1 Amount of memory in Kilobytes to use
Iterations t 1 -> 2^32 - 1 Number of times to hash password or message
Secret K 0 -> 2^32 - 1 Optional key
Associated Data X 0 -> 2^32 - 1 Optional arbitrary data

Memory

There are additional parameters that you can specify to increase the security of hashing. One of the big features is --memory, which specifics in kilobytes, the memory cost of hashing. Argon2 uses a memory-hard approach, which requires a large amount of memory to compute the hash function. This makes it more difficult for attackers to use specialized hardware, such as GPUs or ASICs, to perform brute-force attacks against hashed passwords.


[!WARNING] Memory Warning Do not set the memory to extremely high values. The larger the memory specified, the longer hashing takes. This application limits the memory to 4GB (4194304 kb).


In the example below, we will specify 32 megabytes of memory.


xsum --generate "This is my string" --algo argon2 --memory 32768


Hash Length

You can also specify the length of the hash to output by using --length. The length is the byte length of string P expressed as 32-bit integer. It must be a value between 4 to 2^(32)-1 (4294967295).


xsum --generate "This is my string" --algo argon2 --memory 32768 --length 4


xsum --generate "This is my string" --algo argon2 --memory 32768 --length 512


Salt

In cryptography, a salt is random data fed as an additional input to a one-way function that hashes data, a password or passphrase. Salting helps defend against attacks that use precomputed tables (e.g. rainbow tables), by vastly growing the size of table needed for a successful attack.

To specify a salt:


xsum --generate "This is my string" --algo argon2 --length 128 --salt "My Random Salt Phrase"


Iterations

The number of iterations over the memory. The execution time correlates linearly with this parameter. It allows you to increase the computational cost required to calculate one hash. The higher the number, the longer the hash will take to generate.


xsum --generate "This is my string" --algo argon2 --iterations 4


xsum --generate "This is my string" --algo argon2 --iterations 40



Threads / Parallelism

Defines the number of independent threads to utilize when hashing.

xsum --generate "This is my string" --algo argon2 --threads 2