Huangshan Meirun黄山美润电子
RF PCB Factory · Since 2016射频 PCB 工厂 · 自 2016 年
SECURITY GUIDE · 6-MIN READ安全指南 · 6 分钟读完

Rolling Code vs Fixed Code: 3 Wireless Encoding Types Compared固定码 vs 学习码 vs 滚动码:3 种无线编码安全性实测

By Huangshan Meirun Electronics · Oct 8, 2026黄山美润电子 · 2026-10-08

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)

Learning Code (EV1527)学习码(EV1527)

Rolling Code (HCS301 / KEELOQ)滚动码(HCS301 / KEELOQ)

2. Security Comparison二、安全性对比

Dimension维度Fixed固定码Learning学习码Rolling滚动码
Code space码空间256~4K1M+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特性PT2262PT2262EV1527EV1527HCS301HCS301
Type编码Fixed固定码Learning学习码Rolling滚动码
Package封装DIP/SOP-18SOP-8DIP/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:11:15~301:4~8
Apps应用Toys/bells玩具/门铃Parking/gates停车场/道闸Garage/auto车库/汽车

5. When to Use Each五、什么场景该用什么码

Fixed Code → Only for non-security固定码 → 只能用于不涉及安全的场景
Learning Code → Best cost-performance学习码 → 性价比最高的中间方案
Rolling Code → Mandatory for security/asset滚动码 → 涉及安全/资产的场景必须用

6. Factory Pitfalls六、工厂实战避坑

  1. HCS301 needs key programmingHCS301 需要烧录密钥 — can't buy blanks and solder. Factory: buy blanks → programmer → SMT不能直接买空片贴板。流程:采购空片 → 编程器烧录 → 贴片
  2. Sync counter overflow同步计数器溢出 — 16-bit wraps at 65535, receiver firmware must handle16 位循环,65535 回到 0,接收端固件要处理回绕
  3. Limited learn capacity学习数量限制 — HCS301: 4~8 remotes max. Need 30 remotes? Use EV1527 insteadHCS301 限制 4~8 个遥控器。需要 30 个?用 EV1527 更实际
  4. Debugging difficulty调试难度 — Fixed code: logic analyzer. Rolling code: KEELOQ decrypt tools固定码用逻辑分析仪,滚动码需要 KEELOQ 解密工具
  5. Chip supply risk芯片缺货 — HCS301 = Microchip proprietary. We also support Chinese-compatible alternativesHCS301 是 Microchip 专有。我们也支持国产兼容方案

7. Real Cases七、真实案例

Need Rolling Code on Your Next Product?下一个产品要用滚动码?

Tell us your encoding requirement. Free solution + quote in 24 hours.把编码需求发过来,24 小时内免费出方案 + 报价。

WhatsApp UsWhatsApp 咨询 Get a Quote询盘