# Class CryptoAdas

Namespace
  adas_core.Domain.Utils

Assembly
  adas-core.Domain.dll

Provides a static container for cryptographic operations and utilities related to the Adas domain.

    public static class CryptoAdas

Inheritance
  object
  CryptoAdas

Inherited Members
  object.Equals(object)
  object.Equals(object, object)
  object.GetHashCode()
  object.GetType()
  object.MemberwiseClone()
  object.ReferenceEquals(object, object)
  object.ToString()

## 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

`input` string

  The 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

`input` string

  The string to hash. Its ASCII byte representation is used as the input to the MD5 algorithm.

#### Returns

string

  The MD5 hash of `input` formatted 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

`gF` GroupedField

  The grouped field whose names, max, since, regularity, and results are included in the hash input.

`patientId` ObjectId

  The 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

`password` string

  The password string to evaluate against the strong password requirements.

#### Returns

bool

  `true` if 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

`loginPass` string

  The plain text password entered by the user during login.

`passwordHash` string

  The stored BCrypt hash to compare the password against.

#### Returns

bool

  `true` if the password matches the hash; otherwise, `false`.