Nestopia Core API: Nes::Api::Cartridge::Profile::Hash

Overview | Project | Class | Tree | Deprecated | Index
| Nestopia Core API
FRAMES NO FRAMES
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## api
Class Nes::Api::Cartridge::Profile::Hash

    Core::ImplicitBool
       |
       +--Nes::Api::Cartridge::Profile::Hash

class Nes::Api::Cartridge::Profile::Hash
extends Core::ImplicitBool

Hash checksum. Stores SHA-1 and CRC-32 combined or just one of the two.

Constructor Summary
`Hash( const char* sha, const char* crc )` Constructs new checksum from null-terminated strings.
`Hash( const wchar_t* sha, const wchar_t* crc )` Constructs new checksum from null-terminated wide-strings.
`Hash( const dword* sha, dword crc )` Constructs new checksum from input values.
`Hash()` Default constructor.

Method Summary
`void` | `Assign( const wchar_t* sha, const wchar_t* crc )` Assigns new checksum from null-terminated wide-strings.
`void` | `Assign( const dword* sha, dword crc )` Assigns new checksum from input values.
`void` | `Assign( const char* sha, const char* crc )` Assigns new checksum from null-terminated strings.
`void` | `Clear()` Clears the current checksum.
`void` | `Compute( const void* mem, ulong length )` Computes and updates checksum from input.
`void` | `Get( char* sha, char* crc ) const` Returns the current checksum.
`dword` | `GetCrc32() const` Returns the current CRC-32 value.
`const dword*` | `GetSha1() const` Returns the current SHA-1 values.
`bool` | `operator!() const` Checks if checksum is cleared.
`bool` | `operator<( const Hash& hash ) const` Tests for less-than.
`bool` | `operator==( const Hash& hash ) const` Tests for equality.

Constructor Detail

### Hash

    public Hash( const char* sha, const char* crc ) throw();

  Constructs new checksum from null-terminated strings.

Parameters:
  `sha` - SHA-1 string, set to NULL if values shouldn't be used
  `crc` - CRC-32 string, set to NULL if value shouldn't be used

### Hash

    public Hash( const wchar_t* sha, const wchar_t* crc ) throw();

  Constructs new checksum from null-terminated wide-strings.

Parameters:
  `sha` - SHA-1 string, set to NULL if values shouldn't be used
  `crc` - CRC-32 string, set to NULL if value shouldn't be used

### Hash

    public Hash( const dword* sha, dword crc ) throw();

  Constructs new checksum from input values.

Parameters:
  `sha` - SHA-1 value, set to NULL if values shouldn't be used
  `crc` - CRC-32 value, set to 0 if value shouldn't be used

### Hash

    public Hash() throw();

  Default constructor.

Method Detail

### Assign

    public void Assign( const wchar_t* sha, const wchar_t* crc ) throw();

  Assigns new checksum from null-terminated wide-strings.

Parameters:
  `sha` - SHA-1 string, set to NULL if values shouldn't be used
  `crc` - CRC-32 string, set to NULL if value shouldn't be used

### Assign

    public void Assign( const dword* sha, dword crc ) throw();

  Assigns new checksum from input values.

Parameters:
  `sha` - SHA-1 value, set to NULL if values shouldn't be used
  `crc` - CRC-32 value, set to 0 if value shouldn't be used

### Assign

    public void Assign( const char* sha, const char* crc ) throw();

  Assigns new checksum from null-terminated strings.

Parameters:
  `sha` - SHA-1 string, set to NULL if values shouldn't be used
  `crc` - CRC-32 string, set to NULL if value shouldn't be used

### Clear

    public void Clear() throw();

  Clears the current checksum.

### Compute

    public void Compute( const void* mem, ulong length ) throw();

  Computes and updates checksum from input.

Parameters:
  `mem` - pointer to memory
  `length` - length of memory in bytes

### Get

    public void Get( char* sha, char* crc ) const throw();

  Returns the current checksum.

Parameters:
  `sha` - SHA-1 string to be filled, set to to NULL if not needed
  `crc` - CRC-32 string to be filled, set to NULL if not needed

### GetCrc32

    public dword GetCrc32() const throw();

  Returns the current CRC-32 value.

Returns:
  CRC-32 value, 0 if unused

### GetSha1

    public const dword* GetSha1() const throw();

  Returns the current SHA-1 values.

Returns:
  SHA-1 values, zero-filled if unused

### operator!

    public bool operator!() const throw();

  Checks if checksum is cleared.

Returns:
  true if cleared

### operator<

    public bool operator<( const Hash& hash ) const throw();

  Tests for less-than.

Parameters:
  `hash` - hash to compare with
Returns:
  true if input hash is less than this

### operator==

    public bool operator==( const Hash& hash ) const throw();

  Tests for equality.

Parameters:
  `hash` - hash to compare with
Returns:
  true if hashes are equal

Overview | Project | Class | Tree | Deprecated | Index
| Nestopia Core API
FRAMES NO FRAMES
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD