-
Notifications
You must be signed in to change notification settings - Fork 217
NVSHAS-9993: Replace md5 by sha256 #2015
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
Conversation
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.
Overall, LGTM
I just have a minor question regarding the use of GetGuid. Would you mind taking a quick look to see if any adjustment might be needed?
} | ||
|
||
return GetMd5(base64.StdEncoding.EncodeToString(b)), nil | ||
return strings.Replace(uuid.NewString(), "-", "", -1), nil |
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.
Should we change this to use a UUID instead?
However, using a UUID would make the ID non-deterministic and unpredictable.
I think it’s better to switch to SHA (e.g., SHA-256) so the ID remains consistent for the same input, while still being more secure than MD5.
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.
UUID is 128-bit number(typically represented as a 36-character string) & sha256 is 256-bit number.
Using sha256, instead of md5, to generate a UUID is not more secure.
There is no input parameter for GetGuid(). What does "ID remains consistent for the same input" mean?
GetGuid() should not return the same string
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.
you are right, I misunderstand the caller.
} | ||
|
||
return GetMd5(base64.StdEncoding.EncodeToString(b)), nil | ||
return strings.Replace(uuid.NewString(), "-", "", -1), nil |
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.
you are right, I misunderstand the caller.
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.
Generally it looks good to me. Would this affect multi-cluster scenario, given that we are removing some fields from its API response?
GetFedKvVer() in kv/upgrade.go is changed to return different value since 5.4.5.
One side effect of the md5 to sha256 replacement in multi-cluster setup is: |
No description provided.