Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ecdsa keygen GeneratePreParams very slow #312

Open
m2k1024 opened this issue Feb 21, 2025 · 0 comments
Open

Ecdsa keygen GeneratePreParams very slow #312

m2k1024 opened this issue Feb 21, 2025 · 0 comments

Comments

@m2k1024
Copy link

m2k1024 commented Feb 21, 2025

我用该库打出了android平台的aar包,但是执行生成分片的时候很慢,我不知道该怎么优化这个

网页源码:
// When using the keygen party it is recommended that you pre-compute the "safe primes" and Paillier secret beforehand because this can take some time.
// This code will generate those parameters using a concurrency limit equal to the number of available CPU cores.
preParams, _ := keygen.GeneratePreParams(1 * time.Minute)

我尝试生成2/3的mpc钱包分片,以下是我生成预参数的代码,在Android手机上生成非常慢:

// EcdsaKeygenPre 函数用于生成ECDSA密钥生成所需的预参数。
// 它会为每个参与者生成预参数,并在所有预参数生成完成后调用回调函数通知结果。
// 如果在生成过程中出现错误,会清空预参数列表并调用回调函数通知失败。
func EcdsaKeygenPre(callback KeygenGenerateCallback) {
// 循环为每个参与者生成预参数
for i := 0; i < Participants; i++ {
// 生成预参数,设置超时时间为10分钟
params, err := ecdsaKeygen.GeneratePreParams(1 * time.Minute)
// 检查生成预参数是否出错
if err != nil {
common.Logger.Errorf("Error generating pre-parameters: %v", err)
// 出错则清空预参数列表
preParams = []ecdsaKeygen.LocalPreParams{}
// 调用回调函数通知预参数生成失败
callback.OnEcdsaKeygenPreComplete(false)
return
}

	// 获取当前时间
	date := time.Now()
	// 打印当前时间,用于调试
	fmt.Printf("11--------%v\n", date)
	// 将生成的预参数添加到预参数列表中
	preParams = append(preParams, *params)
}
// 检查预参数列表的长度是否达到参与者数量
if len(preParams) == Participants {
	// 达到则调用回调函数通知预参数生成成功
	callback.OnEcdsaKeygenPreComplete(true)
}

}

麻烦给我一个解决方案,谢谢

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant