# Class: MACH

## MACH

This is a description of the MACH class.

#### new MACH()

### Methods

#### (static) calculateEntropy()

  See:
    - Binary.calculateEntropy

#### (static) calculateMD5()

  See:
    - Binary.calculateMD5

#### (static) compare()

  See:
    - Binary.compare

#### (static) compareEP()

  See:
    - PE.compareEP

#### (static) compareOverlay()

  See:
    - PE.compareOverlay

#### (static) findByte()

  See:
    - Binary.findByte

#### (static) findDword()

  See:
    - Binary.findDword

#### (static) findSignature()

  See:
    - Binary.findSignature

#### (static) findString()

  See:
    - Binary.findString

#### (static) findWord()

  See:
    - Binary.findWord

#### (static) getEntryPointOffset() → {Int64}

  Get the offset of the entry point.

  ##### Returns:

  If an error occurs, -1 will be returned.
  Type
    Int64

#### (static) getFileBaseName()

  See:
    - Binary.getFileBaseName

#### (static) getFileCompleteSuffix()

  See:
    - Binary.getFileCompleteSuffix

#### (static) getFileDirectory()

  See:
    - Binary.getFileDirectory

#### (static) getFileSuffix()

  See:
    - Binary.getFileSuffix

#### (static) getGeneralOptions() → {String}

  Get a string in the form of `"MACHtypeMACHmode"`. For example `"EXE32"` or `"DYLIB64"`.

  ##### Returns:

  Type
    String

#### (static) getLibraryCurrentVersion(sLibrary) → {String}

  Get the current version of a library.

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `sLibrary` | String | The name of the library.

  ##### Returns:

  Type
    String

#### (static) getNumberOfPrograms() → {Int}

  Get the number of programs in the program header table(pht).

  ##### Returns:

  Type
    Int

#### (static) getNumberOfSections() → {Int}

  Get the number of sections.

  ##### Returns:

  Type
    Int

#### (static) getNumberOfSections() → {Int}

  Get the number of sections.

  ##### Returns:

  Type
    Int

#### (static) getNumberOfSegments() → {Int}

  Get the number of segments.

  ##### Returns:

  Type
    Int

#### (static) getOverlayOffset() → {Int}

  Get the file offset of the overlay.

  ##### Returns:

  Type
    Int

#### (static) getOverlaySize() → {Int}

  Get the size of the overlay.

  ##### Returns:

  Type
    Int

#### (static) getSectionFileOffset(nSection) → {UInt}

  Get the file offset of a section.

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `nSection` | Int | Section number.

  ##### Returns:

  Type
    UInt

#### (static) getSectionFileSize(nSection) → {UInt}

  Get the file size of a section.

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `nSection` | Int | Section number.

  ##### Returns:

  Type
    UInt

#### (static) getSectionName(nSection) → {UInt}

  Get the name of a section.

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `nSection` | Int | Section number.

  ##### Returns:

  Type
    UInt

#### (static) getSectionNumber(sSectionName) → {Int}

  Get the number of a section with a specific name.

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `sSectionName` | String | Section name.

  ##### Returns:

  0-based section number, or `-1` if there is no section with that name.
  Type
    Int

#### (static) getSegmentFileOffset(nSection) → {UInt}

  Get the file offset of a segment.

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `nSection` | Int | Section number.

  ##### Returns:

  Type
    UInt

#### (static) getSegmentFileSize(nSection) → {UInt}

  Get the file size of a segment.

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `nSection` | Int | Section number.

  ##### Returns:

  Type
    UInt

#### (static) getSegmentName(nSection) → {UInt}

  Get the name of a segment.

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `nSection` | Int | Section number.

  ##### Returns:

  Type
    UInt

#### (static) getSignature()

  See:
    - Binary.getSignature

#### (static) getSize()

  See:
    - Binary.getSize

#### (static) getString()

  See:
    - Binary.getString

#### (static) isLibraryPresent(sLibraryName) → {Bool}

  Check if there is a library with a specific name in the import table.

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `sLibraryName` | String | The name of the library.

  ##### Returns:

  Type
    Bool

#### (static) isOverlayPresent() → {Bool}

  Check if an overlay is present.

  ##### Returns:

  Type
    Bool

#### (static) isSectionNamePresent(sSectionName) → {Bool}

  Check if a section exists with a specific name or matches a regular expression.

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `sSectionName` | String | Section name or pattern.

  ##### Returns:

  Type
    Bool

#### (static) isSignaturePresent()

  See:
    - Binary.isSignaturePresent

#### (static) OffsetToRVA(nOffset) → {Int64}

  Convert a file offset to a relative virtual address (RVA).

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `nOffset` | UInt64 |

  ##### Returns:

  If an error occurs, -1 will be returned.
  Type
    Int64

#### (static) OffsetToVA(nOffset) → {Int64}

  Convert a file offset to a virtual address (VA).

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `nOffset` | UInt64 |

  ##### Returns:

  If an error occurs, -1 will be returned.
  Type
    Int64

#### (static) readByte()

  See:
    - Binary.readByte

#### (static) readDword()

  See:
    - Binary.readDword

#### (static) readWord()

  See:
    - Binary.readWord

#### (static) RVAToOffset(nRVA) → {Int64}

  Convert a relative virtual address (RVA) to a file offset.

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `nRVA` | UInt64 |

  ##### Returns:

  If an error occurs, -1 will be returned.
  Type
    Int64

#### (static) swapBytes()

  See:
    - Binary.swapBytes

#### (static) VAToOffset(nVA) → {Int64}

  Convert a virtual address (VA) to a file offset.

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `nVA` | UInt64 |

  ##### Returns:

  If an error occurs, -1 will be returned.
  Type
    Int64