A device 2 (e.g. a game console) authenticates a peripheral device 1 (e.g. a device including a battery 14 and storage 12, processing 11 and communication 13 units) when they are attached and prior to use. One or both devices may perform the authentication. The authenticating device generates a random number and sends this to the other device along with a number which is used to index a constant and an encryption key, copies of which are stored in each device. The stored constant is appended or prepended to the random number to form a challenge code and encrypted with the key by both devices. In a preferred embodiment, only a part of the encrypted result is returned to the authenticating device for comparison with the result generated by itself. A match may be communicated to the other device by sending the same encrypted part, whilst a mismatch may be indicated by sending the same part with all bits inverted. A match results in the peripheral device being functionally connected to the device. Other applications include connection of a battery to a charger.