我正在尝试使用CBOR.encode
中的SwiftCBOR
方法转换有效载荷,从而给我一个Array<UInt8>
格式的结果,当对该结果进行哈希处理时,它会以{{ 1}}格式,但我需要它的哈希值
Array<UInt8>
哈希payload = {productName:"Philips Hue White A19 4-Pack 60W Equivalent Dimmable LED Smart Bulb"}
let payloadBytes = CBOR.encode(payload)
print("payloadbytes:",payloadBytes); // payloadbytes: [120, 83, 123,..., 98, 34, 125]
print("hashed payload",payloadBytes.sha512()); //[176, 26, 154,..., 85, 75, 77]
的预期输出是
6097B04A89468E7AAA8A1784B9CBAF0D2E968AFFC7F5AFE3B0B30CDF44A79EB41464EC773D0D729FA7E6AD6F7462EDEA09B34177CDB0D0DF4A6DDF3C6117C01E