The function signature (which is a 4 bytes code) is used internally in solidity to call the function. However for a user interface to show the user some readable information it is useful to lookup the function name, which can be done via https://www.4byte.directory.
Clef integrates the entire 4bytes database to provide the same information.
Developers can add new functions via https://www.4byte.directory/import-solidity
Clef also has the option: --4bytedb-custom value to add new functions
Suppose you have function:
function setA(uint256 _a) { a = _a; }
Then the function signature is calculated with:
keccak("setA(uint256)")
Using https://emn178.github.io/online-tools/keccak_256.html, this calculates to:
ee919d50445cd9f463621849366a537968fe1ce096894b0d0c001528383d4769
Taking the first 8 characters (=4 bytes), this results in (hex):
0xee919d50.
This is stored in a 4 byte-database, as can be seen here:
https://www.4byte.directory/signatures/?bytes4_signature=0xee919d50
ID Text Signature Bytes Signature
90738 setA(uint256) 0xee919d50
Also see: