Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OutOfMemoryException when creating Argon2() #39

Open
tg24 opened this issue Mar 24, 2021 · 1 comment
Open

OutOfMemoryException when creating Argon2() #39

tg24 opened this issue Mar 24, 2021 · 1 comment

Comments

@tg24
Copy link

tg24 commented Mar 24, 2021

From time to time I've got an OutOfMemoryException when doing the following in version 1.1.10 (November, 18th 2020):

var argon2A = new Argon2(config);

My configuration looks like this:

{Isopoh.Cryptography.Argon2.Argon2Config}
    AssociatedData: null
    ClearPassword: false
    ClearSecret: false
    HashLength: 32
    Lanes: 4
    MemoryCost: 131072
    Password: null
    Salt: null
    Secret: null
    SecureArrayCall: {Isopoh.Cryptography.SecureArray.DefaultWindowsSecureArrayCall}
    Threads: 4
    TimeCost: 3
    Type: HybridAddressing
    Version: Nineteen

The exception states the following:
Failed to allocate 16777216-byte Argon2 block array, memory cost 131072, lane count 4.

The exception occurs sporadically but it's not comprehensible in which situation.
Since it is an x86 application I thought it's about the memory consumption of my application but i've doublechecked this - it's just around 600MB. If I'm going to decrease the memory cost at some point it works.

@nukeme1
Copy link

nukeme1 commented Feb 9, 2022

I have also noticed this issue using a different set of configurations:

       var res = new Argon2Config
        {
            Type = Argon2Type.DataIndependentAddressing,
            Password = Encoding.UTF8.GetBytes(GetValidStringFromInput(input)),
            Salt = DeriveSaltFromContent(input, argonVer),
            ClearPassword = true,
            ClearSecret = true,
        };

with the usage example:

      SecureArray<byte> res = null;
        using (var hasher = new Argon2(config))
            res = hasher.Hash();`

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants