HMAC 代码
import hmac, hashlib
def _generate_signature(data):
key = '123' # Defined as a simple string.
key_bytes= bytes(key , 'latin-1')
data_bytes = bytes(data, 'latin-1') # Assumes `data` is also a string.
return hmac.new(key_bytes, data_bytes , hashlib.sha256).hexdigest()
print(
_generate_signature('i am priyam')
)
在 Socket CAN 中发送和接收消息
ifconfig vcan0
sudo modprobe vcan
sudo ip link add dev vcan0 type vcan
sudo ip link set up vcan0
cansend vcan0 123#1122334455667788
candump vcan0