Devices, systems, and techniques for generating an encryption key using detected motion from a device. In one example, a method may include receiving movement information indicative of motion detected by a first device during a period of time in which the first device and a second device were bumped together, determining a set of values that represent at least one characteristic of the movement information, and generating, based on the set of values, an encryption key for at least one of encrypting and decrypting data communicated between the first device and the second device. In some examples, the first device may include a sensor configured to detect each time the first device is bumped with the second device during the period of time. The first and second devices may be an implantable medical device and a programmer for the implantable medical device.