Comments (11)
设P=(x P , y P )是定义在F p 上椭圆曲线E:y 2 = x 3 + ax + b上的一个点,ỹ P 为y P 的最右边的一个比特,
则点P可由x P 和比特ỹ P 表示。
由x P 和ỹ P 恢复y P 的方法如下:
a) 计算域元素α=(x P 3 + ax P + b) modp;
b) 计算α modp的平方根β(参见附录B.1.4),若输出是“不存在平方根”,则报错;
c) 若β的最右边比特等于ỹ P ,则置y P =β;否则置y P = p − β。
我看的是这个。。。莫非我们看的标准不是同一个吗??
from gmsm.
我们看的是同一个标准,你摘录的应该是GB/T 32918.1-2016 的A5.2 节的内容。但是这节的内容标题是:F_p上椭圆曲线点的压缩与解压缩方法。而4.2.9的描述中主要是点到字节串的转换,而sm2.go的实现部分是:
func Compress(a *PublicKey) []byte {
buf := []byte{}
yp := getLastBit(a.Y)
buf = append(buf, a.X.Bytes()...)
if n := len(a.X.Bytes()); n < 32 {
buf = append(zeroByteSlice[:(32-n)], buf...)
}
buf = append([]byte{byte(yp)}, buf...)
return buf
}
该函数输出是字节串,因此我认为应该以02或03开头。
from gmsm.
Compress函数输入是一个点,那么输出既然是字节串,那么也应该加上02或03
from gmsm.
那我空了看看吧。。。哈哈,可能看漏了。。。不过我看商业的实现貌似不是bit是byte。。这个是什么情况呢。。。兄台你们取的是Bit还是byte
from gmsm.
byte
from gmsm.
好吧。。那我空了改一下。。。不过最近很忙
from gmsm.
多谢指正啊
from gmsm.
话说你是巴比特的人?
from gmsm.
是的,但是比原链和巴比特其实属于公司的不同的产品线
from gmsm.
哦
from gmsm.
mmm, 看上去这个 issue 还在..
from gmsm.
Related Issues (20)
- [BUG] GHASH逻辑错误造成GCM模式下tag错误 HOT 2
- sm2.Decompress方法的入残,该是什么格式的公钥? HOT 2
- 用node.js sm2加密,最新gmsm sm2无法解密 HOT 3
- 无法解析openssl和gmssl生成的sm2密钥,但是gmssl可以解析gmsm和openssl生成的 HOT 4
- 希望能支持ed25519和tls13
- 能否加一个zeroPadding,不知道咋写 HOT 1
- sm3 does not correctly implement hash.Hash
- 这个库还有人维护么?
- 兼容性问题
- 可以去掉conn.go第1304行的fmt.Println吗
- 请问 `gmtls/gmcredentials/testdata/` 路径下的证书、秘钥是如何生成的 HOT 1
- 握手失败
- 缺失方法导入公钥然后使用公钥加密
- 希望可以有tls的使用样例,以及一些问题反馈 HOT 2
- 压缩公钥方法第一位表示符和java的不一样 HOT 1
- 后端验签失败 HOT 1
- handshake error : remote error: tls: protocol version not supported
- Sm4GCM SM4 GCM 加解密模式gmsm/sm4/sm4_gcm与gmsm/gmtls中aead中gcm实现效果不一致 HOT 2
- sm2解密不会自动在密文前加04,别的库都会自动判断是否04开头,强烈库里自动封装好
- 关于Java调用 PKCS7信封+SM2实现的问题
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from gmsm.