Closed BigShieldsy closed 1 year ago
Hope you got your answer before this because it has been a while since you asked, but...
There is an extension method DecodeString()
on Argon2Config
so you should be able to do something like:
var config = new Argon2Config;
config.DecodeString(justHashedValue, out var hash);
var version = config.Version;
Or, you can use a regex - for Argon2, the version is encoded in the hash string. Look for $v=(\d*)
, the digits in the capture group are the Argon2 version. As a matter of fact, I'm going to wing a regex to pull out all the relevant parts:
^\$argon2(?<type>i?d?)\$v=(?<version>\d+)\$m=(?<memory>\d+),t=(?<time>\d+),p=(?<parallelism>\d+)(?:,data=(?<data>[A-Za-z0-9/+]+=*))?\$(?<salt>[A-Za-z0-9/+]+=*)\$(?<hash>[A-Za-z0-9/+]+=*)$
This should give you:
Caveat: I haven't tested the C# or regex...
Found this package a great asset for my project, however, I am wondering if there was a way for me to get the version number being used during the hashing process?