如何在SocketCAN中发送和接收HMAC(哈希消息验证码)CAN消息?

时间:2019-01-21 10:44:11

标签: python shell cryptography hmac socketcan

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')
)

可以发送并接收短信给邮件

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

0 个答案:

没有答案