-
Notifications
You must be signed in to change notification settings - Fork 2.9k
feat: Optimize encryption method #7908
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,9 +1,9 @@ | ||
| @font-face { | ||
| font-family: "iconfont"; /* Project id 4776196 */ | ||
| src: url('iconfont.woff2?t=1738832240410') format('woff2'), | ||
| url('iconfont.woff?t=1738832240410') format('woff'), | ||
| url('iconfont.ttf?t=1738832240410') format('truetype'), | ||
| url('iconfont.svg?t=1738832240410#iconfont') format('svg'); | ||
| src: url('iconfont.woff2?t=1739873339591') format('woff2'), | ||
| url('iconfont.woff?t=1739873339591') format('woff'), | ||
| url('iconfont.ttf?t=1739873339591') format('truetype'), | ||
| url('iconfont.svg?t=1739873339591#iconfont') format('svg'); | ||
| } | ||
|
|
||
| .iconfont { | ||
|
|
@@ -14,8 +14,8 @@ | |
| -moz-osx-font-smoothing: grayscale; | ||
| } | ||
|
|
||
| .p-terminal3:before { | ||
| content: "\eace"; | ||
| .p-terminal2:before { | ||
| content: "\e82f"; | ||
| } | ||
|
|
||
| .p-tuijian:before { | ||
|
|
@@ -70,14 +70,6 @@ | |
| content: "\e638"; | ||
| } | ||
|
|
||
| .p-terminal:before { | ||
| content: "\e864"; | ||
| } | ||
|
|
||
| .p-terminal1:before { | ||
| content: "\e663"; | ||
| } | ||
|
|
||
| .p-arrow-right:before { | ||
| content: "\e665"; | ||
| } | ||
|
|
@@ -386,10 +378,6 @@ | |
| content: "\e701"; | ||
| } | ||
|
|
||
| .p-zhongduan:before { | ||
| content: "\e61e"; | ||
| } | ||
|
|
||
| .p-17:before { | ||
| content: "\e618"; | ||
| } | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The difference between the two versions seems to be in CSS selector usage and some inline stylesheet tags. There isn't anything that needs an immediate fix but they are both currently using the same style sheet with no changes needed. I recommend maintaining this consistency as it is already functioning normally; there's not much value in changing styles just for one part of code while the rest remains unchanged. The current approach doesn't introduce any inconsistencies or breakages. For now, I will let you maintain this setup without making any further adjustments. For future projects, make sure your coding environment supports all relevant file formats like 'css', 'html' etc. This helps prevent unexpected issues when files from different sources clash due to incompatible extensions. However, since these codes are still quite new and haven’t had time yet to encounter such problems, don't worry about them right now. Keep up the good work! |
||
|
|
||
Large diffs are not rendered by default.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -111,12 +111,12 @@ const submit = async () => { | |
| globalStore.themeConfig.themeColor = xpackRes.data.themeColor; | ||
| } | ||
| loading.value = false; | ||
| switchTheme(); | ||
| initFavicon(); | ||
| uploadRef.value!.clearFiles(); | ||
| uploaderFiles.value = []; | ||
| open.value = false; | ||
| MsgSuccess(i18n.global.t('commons.msg.operationSuccess')); | ||
| switchTheme(); | ||
| initFavicon(); | ||
| window.location.reload(); | ||
| }) | ||
| .catch(() => { | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. To provide a proper answer I need more comprehensive information about the current code provided. Without that, it's difficult to analyze whether there are any irregularities, potential issues or optimizations needed. However, typically when evaluating such codes related to data management and updates, key components could include:
Potential Improvements:
Potential Issues / Irregularities: None found based on provided snippet details as no specific bugs were mentioned directly above. But remember, errors tend to creep up during large scale rewrites due to different conditions and edge cases. Optimization Suggestions: Since this function appears standalone in its context, further optimization would lie within understanding what else might be happening at other places where variables 'globalStore', In general, please ensure that all aspects including data manipulation, error handling, threading logic, and component states properly interact according to your application requirements and architecture/design decisions (whether done explicitly via stateless/reusable UI components vs a single monolithic app). Lastly, always look into existing best practices, tutorials, and guidelines while maintaining compatibility with previous versions for backward compatibility purposes. |
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In the provided code snippet, there is a conflict between implementing
aesEncryptWithSaltand using it directly within StringEncrypt function withkeyinstead of passing it intoStringEncryptWithoutSalt. This might lead to confusion on how to pass key while using aesEncrypt method. Additionally, the encryption key should be set from global configuration before using StringEncrypt without salt but this issue will resolve if Key value gets passed along with text during Encrypt call.Potential areas needing adjustment:
Suggestion (if not used elsewhere):
If using base64 encoding for encrypted message, consider removing the commented out aes encryption lines that use Base64 encoding directly after each loop iteration which could increase complexity.
Optimization/Simplification Suggestion 1:
Refactor to reduce redundancy. If you decide to keep both implementations and only one gets executed at a time, combine the AES operations inside StringEncrypt() and then use an appropriate encoder based on whether it needs Base64 encoded messages (
base64.StdEncoding.EncodeToString()).Optimization/Simplification Suggestion 2:
Use strings.Replace function to ensure consistent escaping or better yet, always encode the key first regardless of what data structure(s) you have been storing the keys in as long as they're stored separately.
This way, overall, you would avoid conflicts introduced due to inconsistent usage patterns between calling
StringEncryptdirectly vs through multiple encryptions via the Salted version.Final Code Implementation Notes:
To further optimize/clarify the usage of key when encrypting text, implement a helper function that accepts text & returns key in case we don't need it globally; also include error handling around checking global variable availability outside its initialization context.
Lastly, since we are modifying encryption logic here, consider updating related comments/documentation sections in other places where the same functionality was implemented in similar contexts. In addition to these general recommendations, you may consult official resources like Go's documentation for best practices and coding guidelines specific to cryptography in C++.