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

左移溢出 #6

Open
ghost opened this issue Apr 3, 2021 · 2 comments
Open

左移溢出 #6

ghost opened this issue Apr 3, 2021 · 2 comments

Comments

@ghost
Copy link

ghost commented Apr 3, 2021

sm4Sbox中:
return (b1 << 24) | (b2 << 16) | (b3 << 8) | (b4 << 0);
您在readme中也说了会左移溢出,但是并没有提解决方案,是对整体加解密没有影响吗?

@windard
Copy link
Owner

windard commented Apr 4, 2021

不是吖,你再仔细看看,我也提到了有一个循环左移的函数实现吖。

function leftshift(a, n, size=32) {
    n = n % size
    return (a << n) | (a >>> (size - n))
}

@ghost
Copy link
Author

ghost commented Apr 13, 2021

不是吖,你再仔细看看,我也提到了有一个循环左移的函数实现吖。

function leftshift(a, n, size=32) {
    n = n % size
    return (a << n) | (a >>> (size - n))
}

谢谢,是我傻了,已经解决了

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