// CreateHash returns a Argon2id hash of a plain-text password using the
// provided algorithm parameters. The returned hash follows the format used by
// the Argon2 reference C implementation and contains the base64-encoded Argon2id d
// derived key prefixed by the salt and parameters. It looks like this:
//
//		$argon2id$v=19$m=65536,t=3,p=2$c29tZXNhbHQ$RdescudvJCsgt3ub+b+dWRWJTmaaJObG
//
CreateHash returns a Argon2id hash of a plain-text password using the
provided algorithm parameters. The returned hash follows the format used by
the Argon2 reference C implementation and contains the base64-encoded Argon2id d
derived key prefixed by the salt and parameters. It looks like this.

$argon2id$v=19$m=65536,t=3,p=2$c29tZXNhbHQ$RdescudvJCsgt3ub+b+dWRWJTmaaJObG
// CreateHash returns a Argon2id hash of a plain - text password using the // provided algorithm parameters . The returned hash follows the format used by // the Argon2 reference C implementation and contains the base64 - encoded Argon2id d // derived key prefixed by the salt and parameters . It looks like this : // // $argon2id$v = 19$m = 65536 t = 3 p = 2$c29tZXNhbHQ$RdescudvJCsgt3ub + b + dWRWJTmaaJObG //
func CreateHash(password string, params *Params) (hash string, err error) {
	salt, err := generateRandomBytes(params.SaltLength)
	if err != nil {
		return "", err
	}
	key := argon2.IDKey([]byte(password), salt, params.Iterations, params.Memory, params.Parallelism, params.KeyLength)
	b64Salt := base64.RawStdEncoding.EncodeToString(salt)
	b64Key := base64.RawStdEncoding.EncodeToString(key)
	hash = fmt.Sprintf("$argon2id$v=%d$m=%d,t=%d,p=%d$%s$%s", argon2.Version, params.Memory, params.Iterations, params.Parallelism, b64Salt, b64Key)
	return hash, nil
}
func CreateHash ( password string , params * Params ) ( hash string , err error ) { salt , err := generateRandomBytes ( params . SaltLength ) if err != nil { return " " , err } key := argon2 . IDKey ( [ ] byte ( password ) , salt , params . Iterations , params . Memory , params . Parallelism , params . KeyLength ) b64Salt := base64 . RawStdEncoding . EncodeToString ( salt ) b64Key := base64 . RawStdEncoding . EncodeToString ( key ) hash = fmt . Sprintf ( " " , argon2 . Version , params . Memory , params . Iterations , params . Parallelism , b64Salt , b64Key ) return hash , nil }
CreateHash returns a Argon2id hash of a plain-text password using the
provided algorithm parameters.
CreateHash returns a Argon2id hash of a plain - text password using the provided algorithm parameters .