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

有个算法需要添加 #47

Open
netpr1s0ner opened this issue Jun 11, 2024 · 2 comments
Open

有个算法需要添加 #47

netpr1s0ner opened this issue Jun 11, 2024 · 2 comments

Comments

@netpr1s0ner
Copy link

var key = CryptoJS.enc.Utf8.parse('GftZqNEoBVdB2kwT');

    // iv采用的是16位的,同样为了方便转成UTF8
     var iv = CryptoJS.enc.Utf8.parse('3zyJFPEzh5rUeUNh'); 

    // 加密方式使用CBC,padding偏移量设置成Pkcs7,以便和后端对应解密
   let encryptData = CryptoJS.AES.encrypt(password, key, {
                        mode: CryptoJS.mode.CBC,
                        iv: iv,
                        padding: CryptoJS.pad.Pkcs7
                    });
@netpr1s0ner
Copy link
Author

var key = CryptoJS.enc.Utf8.parse('GftZqNEoBVdB2kwT');

    // iv采用的是16位的,同样为了方便转成UTF8
     var iv = CryptoJS.enc.Utf8.parse('3zyJFPEzh5rUeUNh'); 

    // 加密方式使用CBC,padding偏移量设置成Pkcs7,以便和后端对应解密
   let encryptData = CryptoJS.AES.encrypt(password, key, {
                        mode: CryptoJS.mode.CBC,
                        iv: iv,
                        padding: CryptoJS.pad.Pkcs7
                    });

CryptoJS.AES.encrypt("admin",CryptoJS.enc.Utf8.parse('GftZqNEoBVdB2kwT'), {mode: CryptoJS.mode.CBC,iv: CryptoJS.enc.Utf8.parse('3zyJFPEzh5rUeUNh'),padding: CryptoJS.pad.Pkcs7}).toString()
'UO0cglJMcK2XMdSaoqRePg=='

@whwlsfb
Copy link
Owner

whwlsfb commented Oct 10, 2024

这个已经内置了,可以直接用

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

2 participants