Skip to content

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

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

关于蒙哥马利简约实现 #1

Closed
kingstenzzz opened this issue Aug 31, 2021 · 3 comments
Closed

关于蒙哥马利简约实现 #1

kingstenzzz opened this issue Aug 31, 2021 · 3 comments

Comments

@kingstenzzz
Copy link

kingstenzzz commented Aug 31, 2021

想问一下这里面的实现细节,
1.这里的position指的是哪里?

// At position 86, which is the starting bit position for word 3, we

2.这个 have a factor of 0xffffc00 = 2^29 - 2^11的意思是什么?
// have a factor of 0x1ffff800 = 2**29 - 2**11

3./ Word: 2 3 4 5 6 7 8 9 10
// Added in top half: 29 28 29 29 29 29 29 28
// 29 28 29 28 29
// 29
// Added in bottom half: 28 29 28 28 28 29 28 28
// 28 29 28 29 28
这个表得意思不是很理解。

@emmansun
Copy link
Owner

emmansun commented Sep 1, 2021

我从第三个问题开始回答:

三,首先这个除R的约简是通过不断加上tmp2数组最右(低)字(word)乘P来达成的,一次循环乘两次,虽然都是乘P,但是top half乘的是29 28 29 28 ... 这样位宽表示的P {0x1fffffff, 0xfffffff, 0x7f, 0xffffc00, 0x1fffffff, 0xfffffff, 0x1fffffff, 0xeffffff, 0xfffffff},而bottom half是乘的28 29 28 29... 这样位宽表示的P {0xfffffff, 0x1fffffff, 0x7f, 0x1ffff800, 0xfffffff, 0x1fffffff, 0xfffffff, 0x1dffffff, 0xfffffff},之所以这样是为了和tmp2中的每个word的位宽保持一致,这样方便把乘法表示成加减和位移运算。

二, 就是x 要乘以 0x1ffff800,而0x1ffff800表示成2^29 - 2^11,这是bottom half中乘以P的第四个word。

一,这里的position是指的bit表示的起始位置,参考方法开始部分的注释。
image

@kingstenzzz
Copy link
Author

我从第三个问题开始回答:

三,首先这个除R的约简是通过不断加上tmp2数组最右(低)字(word)乘P来达成的,一次循环乘两次,虽然都是乘P,但是top half乘的是29 28 29 28 ... 这样位宽表示的P {0x1fffffff, 0xfffffff, 0x7f, 0xffffc00, 0x1fffffff, 0xfffffff, 0x1fffffff, 0xeffffff, 0xfffffff},而bottom half是乘的28 29 28 29... 这样位宽表示的P {0xfffffff, 0x1fffffff, 0x7f, 0x1ffff800, 0xfffffff, 0x1fffffff, 0xfffffff, 0x1dffffff, 0xfffffff},之所以这样是为了和tmp2中的每个word的位宽保持一致,这样方便把乘法表示成加减和位移运算。

二, 就是x 要乘以 0x1ffff800,而0x1ffff800表示成2^29 - 2^11,这是bottom half中乘以P的第四个word。

一,这里的position是指的bit表示的起始位置,参考方法开始部分的注释。
image

感谢回复,基本上原理是懂得,但是一些实现的细节不是很清楚想问一下,方便留下一个联系方式(邮箱或者qq)吗?

@emmansun
Copy link
Owner

我已在本项目中开放discussions功能。

Repository owner locked and limited conversation to collaborators Sep 18, 2021

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants