加密編譯測試案例
透過集合功能整理內容
你可以依據偏好儲存及分類內容。
本頁說明供應商可編寫的測試,以驗證加密編譯作業
各個供應商實作項目
Google 建議盡早執行這些測試,以便簡化快速配對整合作業。
測試案例
這類客服案件的資料包括:
- 雜湊
- 花卉濾鏡
- AES 加密與公開金鑰交換
- 訊息編碼與解密
SHA-256 雜湊
輸入值:
0x11, 0x22, 0x33, 0x44, 0x55, 0x66
雜湊結果:
0xBB, 0x00, 0x0D, 0xDD, 0x92, 0xA0, 0xA2, 0xA3, 0x46, 0xF0, 0xB5, 0x31,
0xF2, 0x78, 0xAF, 0x06, 0xE3, 0x70, 0xF8, 0x69, 0x32, 0xCC, 0xAF, 0xCC,
0xC8, 0x92, 0xD6, 0x8D, 0x35, 0x0F, 0x80, 0xF8
AES 加密
輸入值:
0xF3, 0x0F, 0x4E, 0x78, 0x6C, 0x59, 0xA7, 0xBB, 0xF3, 0x87, 0x3B, 0x5A,
0x49, 0xBA, 0x97, 0xEA
密鑰:
0xA0, 0xBA, 0xF0, 0xBB, 0x95, 0x1F, 0xF7, 0xB6, 0xCF, 0x5E, 0x3F, 0x45,
0x61, 0xC3, 0x32, 0x1D
加密輸出:
0xAC, 0x9A, 0x16, 0xF0, 0x95, 0x3A, 0x3F, 0x22, 0x3D, 0xD1, 0x0C, 0xF5,
0x36, 0xE0, 0x9E, 0x9C
ECDH 金鑰交換
Bob 的私密金鑰:
0x02, 0xB4, 0x37, 0xB0, 0xED, 0xD6, 0xBB, 0xD4, 0x29, 0x06, 0x4A, 0x4E,
0x52, 0x9F, 0xCB, 0xF1, 0xC4, 0x8D, 0x0D, 0x62, 0x49, 0x24, 0xD5, 0x92,
0x27, 0x4B, 0x7E, 0xD8, 0x11, 0x93, 0xD7, 0x63
Bob 的公開金鑰:
0xF7, 0xD4, 0x96, 0xA6, 0x2E, 0xCA, 0x41, 0x63, 0x51, 0x54, 0x0A, 0xA3,
0x43, 0xBC, 0x69, 0x0A, 0x61, 0x09, 0xF5, 0x51, 0x50, 0x06, 0x66, 0xB8,
0x3B, 0x12, 0x51, 0xFB, 0x84, 0xFA, 0x28, 0x60, 0x79, 0x5E, 0xBD, 0x63,
0xD3, 0xB8, 0x83, 0x6F, 0x44, 0xA9, 0xA3, 0xE2, 0x8B, 0xB3, 0x40, 0x17,
0xE0, 0x15, 0xF5, 0x97, 0x93, 0x05, 0xD8, 0x49, 0xFD, 0xF8, 0xDE, 0x10,
0x12, 0x3B, 0x61, 0xD2
Alice 的私密金鑰:
0xD7, 0x5E, 0x54, 0xC7, 0x7D, 0x76, 0x24, 0x89, 0xE5, 0x7C, 0xFA, 0x92,
0x37, 0x43, 0xF1, 0x67, 0x77, 0xA4, 0x28, 0x3D, 0x99, 0x80, 0x0B, 0xAC,
0x55, 0x58, 0x48, 0x38, 0x93, 0xE5, 0xB0, 0x6D
Alice 的公開金鑰:
0x36, 0xAC, 0x68, 0x2C, 0x50, 0x82, 0x15, 0x66, 0x8F, 0xBE, 0xFE, 0x24,
0x7D, 0x01, 0xD5, 0xEB, 0x96, 0xE6, 0x31, 0x8E, 0x85, 0x5B, 0x2D, 0x64,
0xB5, 0x19, 0x5D, 0x38, 0xEE, 0x7E, 0x37, 0xBE, 0x18, 0x38, 0xC0, 0xB9,
0x48, 0xC3, 0xF7, 0x55, 0x20, 0xE0, 0x7E, 0x70, 0xF0, 0x72, 0x91, 0x41,
0x9A, 0xCE, 0x2D, 0x28, 0x14, 0x3C, 0x5A, 0xDB, 0x2D, 0xBD, 0x98, 0xEE,
0x3C, 0x8E, 0x4F, 0xBF
產生的共用金鑰 (Alice 的公開金鑰 + 小柏的私人或小包的金鑰)
公開 + Alice 的私人):
0x9D, 0xAD, 0xE4, 0xF8, 0x6A, 0xC3, 0x48, 0x8B, 0xBA, 0xC2, 0xAC, 0x34,
0xB5, 0xFE, 0x68, 0xA0, 0xEE, 0x5A, 0x67, 0x06, 0xF5, 0x43, 0xD9, 0x06,
0x1A, 0xD5, 0x78, 0x89, 0x49, 0x8A, 0xE6, 0xBA
ECDH 共用密鑰的 AES 金鑰
這是 GATT 程序中的步驟 1b (AES 金鑰產生)。
ECDH 共用金鑰:
0x9D, 0xAD, 0xE4, 0xF8, 0x6A, 0xC3, 0x48, 0x8B, 0xBA, 0xC2, 0xAC, 0x34,
0xB5, 0xFE, 0x68, 0xA0, 0xEE, 0x5A, 0x67, 0x06, 0xF5, 0x43, 0xD9, 0x06,
0x1A, 0xD5, 0x78, 0x89, 0x49, 0x8A, 0xE6, 0xBA
產生的 AES 金鑰:
0xB0, 0x7F, 0x1F, 0x17, 0xC2, 0x36, 0xCB, 0xD3, 0x35, 0x23, 0xC5, 0x15,
0xF3, 0x50, 0xAE, 0x57
花卉濾鏡
隨機鹽:
0xC7C8
加入篩選器的第一個帳戶金鑰 (結合上述隨機鹽):
0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88, 0x99, 0x00, 0xAA, 0xBB,
0xCC, 0xDD, 0xEE, 0xFF
產生的 Bloom 濾鏡:
0x02, 0x0C, 0x80, 0x2A
電池資料 (若顯示於廣告內):
0b00110011, // length = 3, show UI indication.
0b01000000, // left bud: not charging, battery level = 64.
0b01000000, // right bud: not charging, battery level = 64.
0b01000000 // case: not charging, battery level = 64.
含有電池資料的 Bloom 濾鏡:
0x01, 0x01, 0x46, 0x0A
已加進篩選器的第二個帳戶金鑰 (結合上述隨機鹽):
0x11, 0x11, 0x22, 0x22, 0x33, 0x33, 0x44, 0x44, 0x55, 0x55, 0x66, 0x66,
0x77, 0x77, 0x88, 0x88
以下兩個新增的帳戶金鑰產生的 bloom 篩選器:
0x84, 0x4A, 0x62, 0x20, 0x8B
電池資料 (若顯示於廣告內):
0b00110011, // length = 3, show UI indication.
0b01000000, // left bud: not charging, battery level = 64.
0b01000000, // right bud: not charging, battery level = 64.
0b01000000 // case: not charging, battery level = 64.
取自兩個新增電池資料的帳戶金鑰產生的表情符號篩選器:
0x46, 0x15, 0x24, 0xD0, 0x08
AES-CTR 加密
輸入資料:「有人的 Google 耳機」編碼為 utf-8 編碼
0x53, 0x6F, 0x6D, 0x65, 0x6F, 0x6E, 0x65, 0x27, 0x73, 0x20, 0x47, 0x6F,
0x6F, 0x67, 0x6C, 0x65, 0x20, 0x48, 0x65, 0x61, 0x64, 0x70, 0x68, 0x6F,
0x6E, 0x65
密鑰:
0x01, 0x23, 0x45, 0x67, 0x89, 0xAB, 0xCD, 0xEF, 0x01, 0x23, 0x45, 0x67,
0x89, 0xAB, 0xCD, 0xEF
Nonce:
0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07
預期的加密結果:
0xEE, 0x4A, 0x24, 0x83, 0x73, 0x80, 0x52, 0xE4, 0x4E, 0x9B, 0x2A, 0x14,
0x5E, 0x5D, 0xDF, 0xAA, 0x44, 0xB9, 0xE5, 0x53, 0x6A, 0xF4, 0x38, 0xE1,
0xE5, 0xC6
HMAC-SHA256
輸入資料:
0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0xEE, 0x4A, 0x24, 0x83,
0x73, 0x80, 0x52, 0xE4, 0x4E, 0x9B, 0x2A, 0x14, 0x5E, 0x5D, 0xDF, 0xAA,
0x44, 0xB9, 0xE5, 0x53, 0x6A, 0xF4, 0x38, 0xE1, 0xE5, 0xC6
密鑰:
0x01, 0x23, 0x45, 0x67, 0x89, 0xAB, 0xCD, 0xEF, 0x01, 0x23, 0x45, 0x67,
0x89, 0xAB, 0xCD, 0xEF
預期的 HMAC-SHA256 結果:
0x55, 0xEC, 0x5E, 0x60, 0x55, 0xAF, 0x6E, 0x92, 0x61, 0x8B, 0x7D, 0x87,
0x10, 0xD4, 0x41, 0x37, 0x09, 0xAB, 0x5D, 0xA2, 0x7C, 0xA2, 0x6A, 0x66,
0xF5, 0x2E, 0x5A, 0xD4, 0xE8, 0x20, 0x90, 0x52
將個人化名稱編碼至其他資料封包
輸入資料:「有人的 Google 耳機」編碼為 utf-8 編碼
0x53, 0x6F, 0x6D, 0x65, 0x6F, 0x6E, 0x65, 0x27, 0x73, 0x20, 0x47, 0x6F,
0x6F, 0x67, 0x6C, 0x65, 0x20, 0x48, 0x65, 0x61, 0x64, 0x70, 0x68, 0x6F,
0x6E, 0x65
密鑰:
0x01, 0x23, 0x45, 0x67, 0x89, 0xAB, 0xCD, 0xEF, 0x01, 0x23, 0x45, 0x67,
0x89, 0xAB, 0xCD, 0xEF
Nonce:
0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07
預期的其他資料封包:
0x55, 0xEC, 0x5E, 0x60, 0x55, 0xAF, 0x6E, 0x92, 0x00, 0x01, 0x02, 0x03,
0x04, 0x05, 0x06, 0x07, 0xEE, 0x4A, 0x24, 0x83, 0x73, 0x80, 0x52, 0xE4,
0x4E, 0x9B, 0x2A, 0x14, 0x5E, 0x5D, 0xDF, 0xAA, 0x44, 0xB9, 0xE5, 0x53,
0x6A, 0xF4, 0x38, 0xE1, 0xE5, 0xC6
將其他資料封包解碼以取得個人化名稱
輸入資料:
0x55, 0xEC, 0x5E, 0x60, 0x55, 0xAF, 0x6E, 0x92, 0x00, 0x01, 0x02, 0x03,
0x04, 0x05, 0x06, 0x07, 0xEE, 0x4A, 0x24, 0x83, 0x73, 0x80, 0x52, 0xE4,
0x4E, 0x9B, 0x2A, 0x14, 0x5E, 0x5D, 0xDF, 0xAA, 0x44, 0xB9, 0xE5, 0x53,
0x6A, 0xF4, 0x38, 0xE1, 0xE5, 0xC6
密鑰:
0x01, 0x23, 0x45, 0x67, 0x89, 0xAB, 0xCD, 0xEF, 0x01, 0x23, 0x45, 0x67,
0x89, 0xAB, 0xCD, 0xEF
預期名稱:「有人的 Google 耳機」編碼為 utf-8 編碼
0x53, 0x6F, 0x6D, 0x65, 0x6F, 0x6E, 0x65, 0x27, 0x73, 0x20, 0x47, 0x6F,
0x6F, 0x67, 0x6C, 0x65, 0x20, 0x48, 0x65, 0x61, 0x64, 0x70, 0x68, 0x6F,
0x6E, 0x65
加密連線狀態欄位
欄位長度和類型:
0b001100101 (length = 3, type = connection status field)
連線狀態:
0b10000101:
* on head detection = 1
* connection availability = 0
* focus mode = 0
* auto-reconnected = 0
* connection state = 0x5 (A2DP with AVRCP)
自訂資料:
0x38
已連線裝置的點陣圖:
0b00001001
連線狀態欄位原始資料 (合計超過 4 個位元組):
0x35853809
使用中的帳戶金鑰 (此為金鑰):
0x04, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88, 0x99, 0x00, 0xAA, 0xBB,
0xCC, 0xDD, 0xEE, 0xFF
未使用的帳戶金鑰:
0x04, 0x11, 0x22, 0x22, 0x33, 0x33, 0x44, 0x44, 0x55, 0x55, 0x66, 0x66,
0x77, 0x77, 0x88, 0x88
隨機鹽:
0xC7C8
帳戶金鑰篩選器 (亦即 IV):透過變更
使用中的帳戶金鑰從 0b00000100 到 0b00000110
0x8C, 0xA9, 0x0C, 0x08, 0x1C
加密連線狀態欄位:
0xF4, 0xBB, 0x40, 0x6F
除非另有註明,否則本頁面中的內容是採用創用 CC 姓名標示 4.0 授權,程式碼範例則為阿帕契 2.0 授權。詳情請參閱《Google Developers 網站政策》。Java 是 Oracle 和/或其關聯企業的註冊商標。
上次更新時間:2025-08-13 (世界標準時間)。
[[["容易理解","easyToUnderstand","thumb-up"],["確實解決了我的問題","solvedMyProblem","thumb-up"],["其他","otherUp","thumb-up"]],[["缺少我需要的資訊","missingTheInformationINeed","thumb-down"],["過於複雜/步驟過多","tooComplicatedTooManySteps","thumb-down"],["過時","outOfDate","thumb-down"],["翻譯問題","translationIssue","thumb-down"],["示例/程式碼問題","samplesCodeIssue","thumb-down"],["其他","otherDown","thumb-down"]],["上次更新時間:2025-08-13 (世界標準時間)。"],[[["\u003cp\u003eThis page provides test cases for providers to validate the cryptographic aspects of their Fast Pair implementation, including hashing, Bloom filter generation, and encryption.\u003c/p\u003e\n"],["\u003cp\u003eGoogle advises incorporating these tests early in the development process for smoother Fast Pair integration.\u003c/p\u003e\n"],["\u003cp\u003eTest cases encompass SHA-256 hashing, Bloom filter construction with and without battery data, AES encryption and decryption, ECDH key exchange, and AES key derivation from ECDH shared secret.\u003c/p\u003e\n"],["\u003cp\u003eExamples and expected outputs are included for each test case, covering scenarios like personalized name encoding/decoding and connection status field encryption.\u003c/p\u003e\n"],["\u003cp\u003eSuccessful completion of these tests ensures the provider's implementation aligns with Fast Pair's security requirements.\u003c/p\u003e\n"]]],[],null,["# Cryptographic Test Cases\n\nThis page describes tests a provider can write to verify the cryptographic\ncomponents of their provider implementation.\n\nGoogle recommends implementing these tests early to ease Fast Pair integration.\n\nTest Cases\n----------\n\nThese cases cover:\n\n- Hashing\n- The Bloom Filter\n- AES Encryption and Public Key Exchange\n- Message enciphering and deciphering\n\n### SHA-256 Hashing\n\nInput value: \n\n 0x11, 0x22, 0x33, 0x44, 0x55, 0x66\n\nHashed result: \n\n 0xBB, 0x00, 0x0D, 0xDD, 0x92, 0xA0, 0xA2, 0xA3, 0x46, 0xF0, 0xB5, 0x31,\n 0xF2, 0x78, 0xAF, 0x06, 0xE3, 0x70, 0xF8, 0x69, 0x32, 0xCC, 0xAF, 0xCC,\n 0xC8, 0x92, 0xD6, 0x8D, 0x35, 0x0F, 0x80, 0xF8\n\n### AES Encryption\n\nInput value: \n\n 0xF3, 0x0F, 0x4E, 0x78, 0x6C, 0x59, 0xA7, 0xBB, 0xF3, 0x87, 0x3B, 0x5A,\n 0x49, 0xBA, 0x97, 0xEA\n\nSecret key: \n\n 0xA0, 0xBA, 0xF0, 0xBB, 0x95, 0x1F, 0xF7, 0xB6, 0xCF, 0x5E, 0x3F, 0x45,\n 0x61, 0xC3, 0x32, 0x1D\n\nEncrypted output: \n\n 0xAC, 0x9A, 0x16, 0xF0, 0x95, 0x3A, 0x3F, 0x22, 0x3D, 0xD1, 0x0C, 0xF5,\n 0x36, 0xE0, 0x9E, 0x9C\n\n### ECDH Key Exchange\n\nBob's private key: \n\n 0x02, 0xB4, 0x37, 0xB0, 0xED, 0xD6, 0xBB, 0xD4, 0x29, 0x06, 0x4A, 0x4E,\n 0x52, 0x9F, 0xCB, 0xF1, 0xC4, 0x8D, 0x0D, 0x62, 0x49, 0x24, 0xD5, 0x92,\n 0x27, 0x4B, 0x7E, 0xD8, 0x11, 0x93, 0xD7, 0x63\n\nBob's public key: \n\n 0xF7, 0xD4, 0x96, 0xA6, 0x2E, 0xCA, 0x41, 0x63, 0x51, 0x54, 0x0A, 0xA3,\n 0x43, 0xBC, 0x69, 0x0A, 0x61, 0x09, 0xF5, 0x51, 0x50, 0x06, 0x66, 0xB8,\n 0x3B, 0x12, 0x51, 0xFB, 0x84, 0xFA, 0x28, 0x60, 0x79, 0x5E, 0xBD, 0x63,\n 0xD3, 0xB8, 0x83, 0x6F, 0x44, 0xA9, 0xA3, 0xE2, 0x8B, 0xB3, 0x40, 0x17,\n 0xE0, 0x15, 0xF5, 0x97, 0x93, 0x05, 0xD8, 0x49, 0xFD, 0xF8, 0xDE, 0x10,\n 0x12, 0x3B, 0x61, 0xD2\n\nAlice's private key: \n\n 0xD7, 0x5E, 0x54, 0xC7, 0x7D, 0x76, 0x24, 0x89, 0xE5, 0x7C, 0xFA, 0x92,\n 0x37, 0x43, 0xF1, 0x67, 0x77, 0xA4, 0x28, 0x3D, 0x99, 0x80, 0x0B, 0xAC,\n 0x55, 0x58, 0x48, 0x38, 0x93, 0xE5, 0xB0, 0x6D\n\nAlice's public key: \n\n 0x36, 0xAC, 0x68, 0x2C, 0x50, 0x82, 0x15, 0x66, 0x8F, 0xBE, 0xFE, 0x24,\n 0x7D, 0x01, 0xD5, 0xEB, 0x96, 0xE6, 0x31, 0x8E, 0x85, 0x5B, 0x2D, 0x64,\n 0xB5, 0x19, 0x5D, 0x38, 0xEE, 0x7E, 0x37, 0xBE, 0x18, 0x38, 0xC0, 0xB9,\n 0x48, 0xC3, 0xF7, 0x55, 0x20, 0xE0, 0x7E, 0x70, 0xF0, 0x72, 0x91, 0x41,\n 0x9A, 0xCE, 0x2D, 0x28, 0x14, 0x3C, 0x5A, 0xDB, 0x2D, 0xBD, 0x98, 0xEE,\n 0x3C, 0x8E, 0x4F, 0xBF\n\nGenerated shared key (either Alice's public + Bob's private or Bob's\npublic + Alice's private): \n\n 0x9D, 0xAD, 0xE4, 0xF8, 0x6A, 0xC3, 0x48, 0x8B, 0xBA, 0xC2, 0xAC, 0x34,\n 0xB5, 0xFE, 0x68, 0xA0, 0xEE, 0x5A, 0x67, 0x06, 0xF5, 0x43, 0xD9, 0x06,\n 0x1A, 0xD5, 0x78, 0x89, 0x49, 0x8A, 0xE6, 0xBA\n\n### AES Key from ECDH Shared Secret\n\nThis is step 1b (AES key generation) in the GATT [procedure](/nearby/fast-pair/specifications/service/gatt#procedure \"Procedure\").\n\nECDH shared key: \n\n 0x9D, 0xAD, 0xE4, 0xF8, 0x6A, 0xC3, 0x48, 0x8B, 0xBA, 0xC2, 0xAC, 0x34,\n 0xB5, 0xFE, 0x68, 0xA0, 0xEE, 0x5A, 0x67, 0x06, 0xF5, 0x43, 0xD9, 0x06,\n 0x1A, 0xD5, 0x78, 0x89, 0x49, 0x8A, 0xE6, 0xBA\n\nGenerated AES key: \n\n 0xB0, 0x7F, 0x1F, 0x17, 0xC2, 0x36, 0xCB, 0xD3, 0x35, 0x23, 0xC5, 0x15,\n 0xF3, 0x50, 0xAE, 0x57\n\n### Bloom Filter\n\nRandom salt: \n\n 0xC7C8\n\nFirst account key added to the filter (combine with the above random salt): \n\n 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88, 0x99, 0x00, 0xAA, 0xBB,\n 0xCC, 0xDD, 0xEE, 0xFF\n\nResulting bloom filter: \n\n 0x02, 0x0C, 0x80, 0x2A\n\nBattery data (if it is contained in the advertisement): \n\n 0b00110011, // length = 3, show UI indication.\n 0b01000000, // left bud: not charging, battery level = 64.\n 0b01000000, // right bud: not charging, battery level = 64.\n 0b01000000 // case: not charging, battery level = 64.\n\nResulting bloom filter with battery data: \n\n 0x01, 0x01, 0x46, 0x0A\n\nSecond account key added to the filter (combine with the above random salt): \n\n 0x11, 0x11, 0x22, 0x22, 0x33, 0x33, 0x44, 0x44, 0x55, 0x55, 0x66, 0x66,\n 0x77, 0x77, 0x88, 0x88\n\nResulting bloom filter from both added account keys: \n\n 0x84, 0x4A, 0x62, 0x20, 0x8B\n\nBattery data (if it is contained in the advertisement): \n\n 0b00110011, // length = 3, show UI indication.\n 0b01000000, // left bud: not charging, battery level = 64.\n 0b01000000, // right bud: not charging, battery level = 64.\n 0b01000000 // case: not charging, battery level = 64.\n\nResulting bloom filter from both added account keys with battery data: \n\n 0x46, 0x15, 0x24, 0xD0, 0x08\n\n### AES-CTR Encryption\n\nInput data: \"Someone's Google Headphone\" with utf-8 encoding \n\n 0x53, 0x6F, 0x6D, 0x65, 0x6F, 0x6E, 0x65, 0x27, 0x73, 0x20, 0x47, 0x6F,\n 0x6F, 0x67, 0x6C, 0x65, 0x20, 0x48, 0x65, 0x61, 0x64, 0x70, 0x68, 0x6F,\n 0x6E, 0x65\n\nSecret key: \n\n 0x01, 0x23, 0x45, 0x67, 0x89, 0xAB, 0xCD, 0xEF, 0x01, 0x23, 0x45, 0x67,\n 0x89, 0xAB, 0xCD, 0xEF\n\nNonce: \n\n 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07\n\nExpected encryption result: \n\n 0xEE, 0x4A, 0x24, 0x83, 0x73, 0x80, 0x52, 0xE4, 0x4E, 0x9B, 0x2A, 0x14,\n 0x5E, 0x5D, 0xDF, 0xAA, 0x44, 0xB9, 0xE5, 0x53, 0x6A, 0xF4, 0x38, 0xE1,\n 0xE5, 0xC6\n\n### HMAC-SHA256\n\nInput data: \n\n 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0xEE, 0x4A, 0x24, 0x83,\n 0x73, 0x80, 0x52, 0xE4, 0x4E, 0x9B, 0x2A, 0x14, 0x5E, 0x5D, 0xDF, 0xAA,\n 0x44, 0xB9, 0xE5, 0x53, 0x6A, 0xF4, 0x38, 0xE1, 0xE5, 0xC6\n\nSecret key: \n\n 0x01, 0x23, 0x45, 0x67, 0x89, 0xAB, 0xCD, 0xEF, 0x01, 0x23, 0x45, 0x67,\n 0x89, 0xAB, 0xCD, 0xEF\n\nExpected HMAC-SHA256 result: \n\n 0x55, 0xEC, 0x5E, 0x60, 0x55, 0xAF, 0x6E, 0x92, 0x61, 0x8B, 0x7D, 0x87,\n 0x10, 0xD4, 0x41, 0x37, 0x09, 0xAB, 0x5D, 0xA2, 0x7C, 0xA2, 0x6A, 0x66,\n 0xF5, 0x2E, 0x5A, 0xD4, 0xE8, 0x20, 0x90, 0x52\n\n### Encode personalized name to additional data packet\n\nInput data: \"Someone's Google Headphone\" with utf-8 encoding \n\n 0x53, 0x6F, 0x6D, 0x65, 0x6F, 0x6E, 0x65, 0x27, 0x73, 0x20, 0x47, 0x6F,\n 0x6F, 0x67, 0x6C, 0x65, 0x20, 0x48, 0x65, 0x61, 0x64, 0x70, 0x68, 0x6F,\n 0x6E, 0x65\n\nSecret key: \n\n 0x01, 0x23, 0x45, 0x67, 0x89, 0xAB, 0xCD, 0xEF, 0x01, 0x23, 0x45, 0x67,\n 0x89, 0xAB, 0xCD, 0xEF\n\nNonce: \n\n 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07\n\nExpected additional data packet: \n\n 0x55, 0xEC, 0x5E, 0x60, 0x55, 0xAF, 0x6E, 0x92, 0x00, 0x01, 0x02, 0x03,\n 0x04, 0x05, 0x06, 0x07, 0xEE, 0x4A, 0x24, 0x83, 0x73, 0x80, 0x52, 0xE4,\n 0x4E, 0x9B, 0x2A, 0x14, 0x5E, 0x5D, 0xDF, 0xAA, 0x44, 0xB9, 0xE5, 0x53,\n 0x6A, 0xF4, 0x38, 0xE1, 0xE5, 0xC6\n\n### Decode additional data packet to get personalized name\n\nInput data: \n\n 0x55, 0xEC, 0x5E, 0x60, 0x55, 0xAF, 0x6E, 0x92, 0x00, 0x01, 0x02, 0x03,\n 0x04, 0x05, 0x06, 0x07, 0xEE, 0x4A, 0x24, 0x83, 0x73, 0x80, 0x52, 0xE4,\n 0x4E, 0x9B, 0x2A, 0x14, 0x5E, 0x5D, 0xDF, 0xAA, 0x44, 0xB9, 0xE5, 0x53,\n 0x6A, 0xF4, 0x38, 0xE1, 0xE5, 0xC6\n\nSecret key: \n\n 0x01, 0x23, 0x45, 0x67, 0x89, 0xAB, 0xCD, 0xEF, 0x01, 0x23, 0x45, 0x67,\n 0x89, 0xAB, 0xCD, 0xEF\n\nExpected name: \"Someone's Google Headphone\" with utf-8 encoding \n\n 0x53, 0x6F, 0x6D, 0x65, 0x6F, 0x6E, 0x65, 0x27, 0x73, 0x20, 0x47, 0x6F,\n 0x6F, 0x67, 0x6C, 0x65, 0x20, 0x48, 0x65, 0x61, 0x64, 0x70, 0x68, 0x6F,\n 0x6E, 0x65\n\n### Encrypted connection status field\n\nField length and type: \n\n 0b001100101 (length = 3, type = connection status field)\n\nConnection state: \n\n 0b10000101:\n\n * on head detection = 1\n * connection availability = 0\n * focus mode = 0\n * auto-reconnected = 0\n * connection state = 0x5 (A2DP with AVRCP)\n\nCustom data: \n\n 0x38\n\nConnected devices bitmap: \n\n 0b00001001\n\nConnection status field raw data (combine above 4 bytes): \n\n 0x35853809\n\nIn use account key (this is the Key): \n\n 0x04, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88, 0x99, 0x00, 0xAA, 0xBB,\n 0xCC, 0xDD, 0xEE, 0xFF\n\nNon-in use account key: \n\n 0x04, 0x11, 0x22, 0x22, 0x33, 0x33, 0x44, 0x44, 0x55, 0x55, 0x66, 0x66,\n 0x77, 0x77, 0x88, 0x88\n\nRandom salt: \n\n 0xC7C8\n\nAccount key filter (this is IV): this is generated by changing the first byte of\nin use account key from 0b00000100 to 0b00000110. \n\n 0x8C, 0xA9, 0x0C, 0x08, 0x1C\n\nEncrypted connection status field: \n\n 0xF4, 0xBB, 0x40, 0x6F\n\n| **Note:** this is encrypted by the original account key, in other words, the first byte of the key is 0x04 not 0x06"]]