---
head:
    - - meta
      - property: og:title
        content: getPlugsHash
    - - meta
      - name: description
        content: Encode a Plugs into a hash and verify the decoded data to verify type compliance.
    - - meta
      - property: og:description
        content: Encode a Plugs into a hash and verify the decoded data to verify type compliance.
notes:
    - - author: Auto generated by @nftchance/plug-types/cli
---
        
# getPlugsHash

Encode a [Plugs](/generated/base-types/Plugs) into a hash and verify the decoded [Plugs](/generated/base-types/Plugs) data from a hash to verify type compliance.

## Parameters

- `$input` : [Plugs](/generated/base-types/Plugs) : The `Plugs` data to encode.

## Returns

- `$typeHash` : `bytes32` : The packet hash of the encoded [Plugs](/generated/base-types/Plugs) data.

## Onchain Implementation

With `getPlugsHash` you can call the function as a `read` and get the encoded data back as a hash. 
        
This is helpful in times when you need to build a message hash without tracking down all the types as well as when you need to verify a signed message hash containing a `Plugs` data type.

::: code-group

``` solidity [Types.sol:getPlugsHash]
function getPlugsHash(
	TypesLib.Plugs memory $input
) public pure virtual returns (bytes32 $typeHash) {
	$typeHash = keccak256(abi.encode(
		PLUGS_TYPEHASH,
		$input.socket,
	getPlugArrayHash($input.plugs),
	keccak256($input.solver),
	$input.salt
	));
}
``` 

:::