Skip to content

Commit

Permalink
update readme
Browse files Browse the repository at this point in the history
  • Loading branch information
ww-rm committed May 21, 2024
1 parent 333f4c2 commit caf0e39
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -253,6 +253,18 @@ print(sm9.decrypt(cipher))

但是在计算各部分数值的时候, 代码里是没有顺序的, 仅仅按照三个独立的 `C1`, `C2`, `C3` 对象返回, 这与密文字节流的构造是分开的.

## 关于 PC 字节

在 SM2/SM9 算法中, 当椭圆曲线上的点转换成字节串时, 需要在开头附加一个字节 PC 加以标识, 非无穷远点按国标要求有三类表示模式:

- 压缩表示形式, PC = `0x02``0x03`
- 未压缩表示形式, PC = `0x04`
- 混合表示形式, PC = `0x06``0x07`

`gmalg` 中所有需要将椭圆曲线上的点转换成字节串时, **一定**带有 PC 标识字节, 但是部分其他项目代码在实现时可能只实现了未压缩表示形式 (PC = `0x04`), 并且可能在提供参数时省略了开头的 PC 字节, 因此在使用时需要注意甄别.

可能涉及密文, 公钥, 随机点等参数的字节串表示形式.

---

*If you think this project is helpful to you, :star: it and let more people see!*

0 comments on commit caf0e39

Please sign in to comment.