Circuits possess an irregular representation. Hence, their data structure (e.g., gate-level netlists) necessitate the encoding into fixed formats like vectors. For machine learning-based tasks, such vectors are the expected format. In contrast, brain-inspired hyperdimensional computing (HDC) can process irregular data structures with its unique encoding algebra. This work is the first to propose HDC for optimized circuit encoding and learning. One advantage of HDC over conventional deep learning algorithms is that it does not require extensive training to encode a gate-level netlist into a hypervector. Furthermore, with HDC-based circuit encoding, the similarity between circuits is efficiently computed as the similarity between their hypervectors, enabling a wide range of applications, such as circuit recognition, verification, and optimization. We introduce CircuitHD, a versatile HDC-based framework for circuit encoding and learning, featuring three encoding methods, each with specific advantages. We demonstrate its effectiveness in two applications: circuit recognition and the detection of hardware intellectual property (IP) piracy, using ITC-99 and ISCAS-85 benchmarks. In circuit recognition, CircuitHD maintains a 97 % accuracy, even when the designs are obfuscated using logic locking. It detects IP piracy across diverse scenarios, achieving a 97.8 % precision, outperforming a state-of-the-art graph neural network approach, with a precision of merely 81 %.