Your garage remote can be copied with a $0.50 cloner. Because 90%+ of low-end remotes use fixed code — press the button, it sends the same code every time.你的车库遥控器,别人花 30 块买个"拷贝器"就能复制。因为市面上 90% 以上的低端遥控器用的是固定码——按一下发一串永远不变的码。
At Huangshan Meirun, we help clients upgrade from fixed code to rolling code every year. Here's the full comparison.作为黄山美润电子的工程师,我们每年帮客户从固定码升级到滚动码。今天把 3 种编码方式全摊开讲。
← Back to Blog返回博客列表1. How Each Encoding Works一、3 种编码方式原理
Fixed Code (PT2262)固定码(PT2262)
- Same code every press. "10110010" × 100 times = still "10110010"每次按键发射的编码完全一样。"10110010" 按 100 次还是 "10110010"
- Code space: 256 ~ 4,096 combinations (8~12 tri-state bits)地址码空间:256 ~ 4096 种(8~12 位三态编码)
Learning Code (EV1527)学习码(EV1527)
- Fixed code per remote, but receiver can "learn" multiple remotes遥控器发固定码,但接收端可以"学习"多个遥控器
- 20-bit address → 1M+ combinations. Still vulnerable to record-and-replay20 位地址码,100 万+ 组合。但码本身不变,仍可被录码复制
Rolling Code (HCS301 / KEELOQ)滚动码(HCS301 / KEELOQ)
- Code changes automatically every press. Record current code → next code is already different每次按键编码自动变化。录下当前码 → 下次发射的码已经变了
- 2³² = 4.2 billion combinations. Theoretically un-brute-forceable2³² = 42 亿种组合,理论不可穷举
2. Security Comparison二、安全性对比
| Dimension维度 | Fixed固定码 | Learning学习码 | Rolling滚动码 |
|---|---|---|---|
| Code space码空间 | 256~4K | 1M+ | 4.2B |
| Replay attack录码重放 | ❌ 1 record opens一录就开 | ❌ 1 record opens一录就开 | ✅ Useless录了没用 |
| Brute force扫描破解 | ⚠️ Seconds几秒 | ⚠️ Hours几小时 | ✅ Impossible不可扫 |
| Cloner拷贝器 | ❌ $0.50 | ❌ $0.50 | ✅ Cannot clone无法复制 |
| Rating安全等级 | ★ | ★★ | ★★★★ |
3. KEELOQ Algorithm (Simplified)三、KEELOQ 滚动码算法原理
1. Factory: burn unique 64-bit key into each remote Key = f(Manufacturer Key, Serial Number) 2. Each button press: - Sync counter +1 (16-bit, 0~65535 cyclic) - Encrypted = KEELOQ_ENCRYPT(Key, Counter || Fixed) - Transmit: [Serial] + [Encrypted] + [Button] 3. Receiver: - Decrypt with same key - Verify counter in window (current ±16) - Valid → execute, update counter - Invalid → reject1. 出厂:烧录 64 位加密密钥 Key = f(厂方密钥, 序列号) 2. 每次按键: - 同步计数器 +1(16 位,0~65535 循环) - 加密码 = KEELOQ_ENCRYPT(密钥, 计数器 || 固定码) - 发射:[序列号] + [加密码] + [按键值] 3. 接收端: - 同一密钥解密 - 验证计数器在窗口内(当前值 ±16) - 通过 → 执行,更新计数器 - 不通过 → 拒绝
✓ Why recording doesn't work:为什么录码没用:
You recorded code X at counter N. Next press → counter is N+1, code is Y≠X. Receiver expects N+1, gets X → REJECT.你录到的码 X,对应计数器值 N。下次发射时计数器已变成 N+1,码是 Y≠X。接收端期望 N+1,收到 X → 拒绝。
4. Chip Comparison四、3 种芯片实战对比
| Feature特性 | PT2262PT2262 | EV1527EV1527 | HCS301HCS301 |
|---|---|---|---|
| Type编码 | Fixed固定码 | Learning学习码 | Rolling滚动码 |
| Package封装 | DIP/SOP-18 | SOP-8 | DIP/SOP-8 |
| Unit cost单价 | $0.040.3 元 | $0.070.5 元 | $0.211.5 元 |
| Address地址码 | 8~12 tri-state三态 | 20 bit位 | 28 serial序列号 + 32 encrypted位加密 |
| Learn qty学习数量 | 1:1 | 1:15~30 | 1:4~8 |
| Apps应用 | Toys/bells玩具/门铃 | Parking/gates停车场/道闸 | Garage/auto车库/汽车 |
5. When to Use Each五、什么场景该用什么码
Fixed Code → Only for non-security固定码 → 只能用于不涉及安全的场景
- ✅ RC toys, doorbells, LED controllers, internal paging玩具遥控车、门铃、LED 灯控、内部呼叫系统
- ❌ NEVER: garage doors, gates, access control, vehicles绝对不要:车库门、道闸、门禁、汽车
Learning Code → Best cost-performance学习码 → 性价比最高的中间方案
- ✅ Parking gates, curtains, restaurant pagers (multi-remote)停车场道闸、电动门/窗帘、餐厅呼叫器(需多遥控配一接收)
- ⚠️ Still vulnerable to record-and-replay仍然可被录码复制
Rolling Code → Mandatory for security/asset滚动码 → 涉及安全/资产的场景必须用
- ✅ Garage doors, car RKE, home security, branded gates车库门/电动门、汽车 RKE、家用安防、品牌电动门/道闸
6. Factory Pitfalls六、工厂实战避坑
- HCS301 needs key programmingHCS301 需要烧录密钥 — can't buy blanks and solder. Factory: buy blanks → programmer → SMT不能直接买空片贴板。流程:采购空片 → 编程器烧录 → 贴片
- Sync counter overflow同步计数器溢出 — 16-bit wraps at 65535, receiver firmware must handle16 位循环,65535 回到 0,接收端固件要处理回绕
- Limited learn capacity学习数量限制 — HCS301: 4~8 remotes max. Need 30 remotes? Use EV1527 insteadHCS301 限制 4~8 个遥控器。需要 30 个?用 EV1527 更实际
- Debugging difficulty调试难度 — Fixed code: logic analyzer. Rolling code: KEELOQ decrypt tools固定码用逻辑分析仪,滚动码需要 KEELOQ 解密工具
- Chip supply risk芯片缺货 — HCS301 = Microchip proprietary. We also support Chinese-compatible alternativesHCS301 是 Microchip 专有。我们也支持国产兼容方案
7. Real Cases七、真实案例
- Garage door brand某品牌车库门: HCS301 + 433MHz, 100k/yr. Zero security complaints (was 20+/month with fixed code):HCS301 + 433MHz,年产 10 万套。0 起安全投诉(之前用固定码每月 20+ 起)
- Parking system某停车场: EV1527 + 315MHz, 30 remotes/receiver, cost-optimal:EV1527 + 315MHz,30 遥控配 1 接收,成本最优
- Smart home OEM某智能家居品牌: HCS301 + AES-128 dual encryption, EU/US export:HCS301 + AES-128 双重加密,出口欧美
Need Rolling Code on Your Next Product?下一个产品要用滚动码?
Tell us your encoding requirement. Free solution + quote in 24 hours.把编码需求发过来,24 小时内免费出方案 + 报价。
WhatsApp UsWhatsApp 咨询 Get a Quote询盘