A suggestion:
Using two way communication.
A sends a 16 byte random number to B
B receives random number and uses secret key and the AES block encryption to encrypt the random number. B sends the encrypted results to A.
A uses original random number and secret key to calculate the encrypted value to compare with the message from B.
Espruino is a JavaScript interpreter for low-power Microcontrollers. This site is both a support community for Espruino and a place to share what you are working on.
A suggestion:
Using two way communication.
A sends a 16 byte random number to B
B receives random number and uses secret key and the AES block encryption to encrypt the random number. B sends the encrypted results to A.
A uses original random number and secret key to calculate the encrypted value to compare with the message from B.