Class CryptoAdas
Provides a static container for cryptographic operations and utilities related to the Adas domain.
public static class CryptoAdas
- Inheritance
-
CryptoAdas
- Inherited Members
Methods
CreateBCrypt(string)
Creates a BCrypt hash from the provided input string, typically used for securely storing passwords.
public static string CreateBCrypt(string input)
Parameters
inputstringThe plain text string to be hashed.
Returns
- string
A BCrypt hashed representation of the input string.
CreateMd5(string)
Computes the MD5 hash of the specified input string and returns it as an uppercase hexadecimal string. The hash bytes are iterated in reverse order before being formatted.
public static string CreateMd5(string input)
Parameters
inputstringThe string to hash. Its ASCII byte representation is used as the input to the MD5 algorithm.
Returns
- string
The MD5 hash of
inputformatted as an uppercase hexadecimal string.
CreateMd5GroupedObs(GroupedField, ObjectId)
Creates a deterministic MD5 hash that uniquely identifies a grouped field configuration for a specific patient. Falls back to a single-element list containing the group's name (or empty string) when the Names collection is null or empty.
public static string CreateMd5GroupedObs(GroupedField gF, ObjectId patientId)
Parameters
gFGroupedFieldThe grouped field whose names, max, since, regularity, and results are included in the hash input.
patientIdObjectIdThe identifier of the patient whose data is being hashed.
Returns
- string
An MD5 hash string representing the combined patient and grouped field data.
IsStrongPassword(string)
Determines whether the specified password meets the strong password criteria defined by the password regex pattern.
public static bool IsStrongPassword(string password)
Parameters
passwordstringThe password string to evaluate against the strong password requirements.
Returns
- bool
trueif the password matches the strong password pattern; otherwise,false.
VerifyPassword(string, string)
Verifies that the provided plain text password matches the stored BCrypt password hash.
public static bool VerifyPassword(string loginPass, string passwordHash)
Parameters
loginPassstringThe plain text password entered by the user during login.
passwordHashstringThe stored BCrypt hash to compare the password against.
Returns
- bool
trueif the password matches the hash; otherwise,false.