해시 바이트 배열 protobuf를 사용하여 전달 중입니다. 직렬화하는 동안, 나는 다음과 같은 오류 받고 있어요 : 나는 그것을 인코딩 \ 디코딩하는 간단한 문제라고 생각파이썬에서 protobuf 바이트 필드를 비 직렬화 할 수 없습니다
a = message.ParseFromString(data)
,하지만 난 더 있습니다
'utf-8' codec can't decode byte 0xd6 in position 1: 'utf-8' codec can't decode byte 0xd6 in position 1: invalid continuation byte in field: master.hash1
를 코드는 단순히 없습니다 그렇게하는 방법.
이
는 C#에서 데이터를 인코딩하는 코드입니다 :public byte[] HmacSign(string key, string message)
{
var encoding = new System.Text.ASCIIEncoding();
byte[] keyByte = encoding.GetBytes(key);
HMACSHA1 hmacsha1 = new HMACSHA1(keyByte);
byte[] messageBytes = encoding.GetBytes(message);
byte[] hashmessage = hmacsha1.ComputeHash(messageBytes);
return hashmessage;
}
인가 utf-8을 사용하여 데이터를 인코딩 했습니까? – Isma