-
Notifications
You must be signed in to change notification settings - Fork 7.1k
[core] Replace SHA-1 with SHA-256 for internal hash operations #60242
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
base: master
Are you sure you want to change the base?
Changes from all commits
9792860
e590c40
abc22a7
1a3712a
799b3b9
c05abc1
72ad997
190f15b
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 | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -45,8 +45,8 @@ def test_tpu_ssh_command_runner(): | |||||||||
| instance = MockTpuInstance(num_workers=num_workers) | ||||||||||
| provider.create_node({}, {}, 1) | ||||||||||
| cluster_name = "cluster" | ||||||||||
| ssh_control_hash = hashlib.sha1(cluster_name.encode()).hexdigest() | ||||||||||
| ssh_user_hash = hashlib.sha1(getuser().encode()).hexdigest() | ||||||||||
| ssh_control_hash = hashlib.sha256(cluster_name.encode()).hexdigest() | ||||||||||
| ssh_user_hash = hashlib.sha256(getuser().encode()).hexdigest() | ||||||||||
|
Comment on lines
+48
to
+49
Contributor
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. For consistency and to avoid platform-dependent behavior, it's better to explicitly specify the encoding as
Suggested change
|
||||||||||
| ssh_control_path = "/tmp/ray_ssh_{}/{}".format( | ||||||||||
| ssh_user_hash[:10], ssh_control_hash[:10] | ||||||||||
| ) | ||||||||||
|
|
@@ -119,8 +119,8 @@ def test_tpu_docker_command_runner(): | |||||||||
| instance = MockTpuInstance(num_workers=num_workers) | ||||||||||
| provider.create_node({}, {}, 1) | ||||||||||
| cluster_name = "cluster" | ||||||||||
| ssh_control_hash = hashlib.sha1(cluster_name.encode()).hexdigest() | ||||||||||
| ssh_user_hash = hashlib.sha1(getuser().encode()).hexdigest() | ||||||||||
| ssh_control_hash = hashlib.sha256(cluster_name.encode()).hexdigest() | ||||||||||
| ssh_user_hash = hashlib.sha256(getuser().encode()).hexdigest() | ||||||||||
|
Comment on lines
+122
to
+123
Contributor
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. For consistency and to avoid platform-dependent behavior, it's better to explicitly specify the encoding as
Suggested change
|
||||||||||
| ssh_control_path = "/tmp/ray_ssh_{}/{}".format( | ||||||||||
| ssh_user_hash[:10], ssh_control_hash[:10] | ||||||||||
| ) | ||||||||||
|
|
||||||||||
| Original file line number | Diff line number | Diff line change | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -62,8 +62,8 @@ def test_ssh_command_runner(): | |||||||||
| provider = MockProvider() | ||||||||||
| provider.create_node({}, {}, 1) | ||||||||||
| cluster_name = "cluster" | ||||||||||
| ssh_control_hash = hashlib.sha1(cluster_name.encode()).hexdigest() | ||||||||||
| ssh_user_hash = hashlib.sha1(getuser().encode()).hexdigest() | ||||||||||
| ssh_control_hash = hashlib.sha256(cluster_name.encode()).hexdigest() | ||||||||||
| ssh_user_hash = hashlib.sha256(getuser().encode()).hexdigest() | ||||||||||
|
Comment on lines
+65
to
+66
Contributor
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. For consistency and to avoid platform-dependent behavior, it's better to explicitly specify the encoding as
Suggested change
|
||||||||||
| ssh_control_path = "/tmp/ray_ssh_{}/{}".format( | ||||||||||
| ssh_user_hash[:10], ssh_control_hash[:10] | ||||||||||
| ) | ||||||||||
|
|
@@ -129,8 +129,8 @@ def test_docker_command_runner(): | |||||||||
| provider = MockProvider() | ||||||||||
| provider.create_node({}, {}, 1) | ||||||||||
| cluster_name = "cluster" | ||||||||||
| ssh_control_hash = hashlib.sha1(cluster_name.encode()).hexdigest() | ||||||||||
| ssh_user_hash = hashlib.sha1(getuser().encode()).hexdigest() | ||||||||||
| ssh_control_hash = hashlib.sha256(cluster_name.encode()).hexdigest() | ||||||||||
| ssh_user_hash = hashlib.sha256(getuser().encode()).hexdigest() | ||||||||||
|
Comment on lines
+132
to
+133
Contributor
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. For consistency and to avoid platform-dependent behavior, it's better to explicitly specify the encoding as
Suggested change
|
||||||||||
| ssh_control_path = "/tmp/ray_ssh_{}/{}".format( | ||||||||||
| ssh_user_hash[:10], ssh_control_hash[:10] | ||||||||||
| ) | ||||||||||
|
|
||||||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -14,11 +14,11 @@ def get_store_name(group_name): | |
| Args: | ||
| group_name: unique user name for the store. | ||
| Return: | ||
| str: SHA1-hexlified name for the store. | ||
| str: SHA256-hexlified name for the store. | ||
| """ | ||
| if not group_name: | ||
| raise ValueError("group_name is None.") | ||
| hexlified_name = hashlib.sha1(group_name.encode()).hexdigest() | ||
| hexlified_name = hashlib.sha256(group_name.encode()).hexdigest() | ||
|
Contributor
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. |
||
| return hexlified_name | ||
|
|
||
|
|
||
|
|
||
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.
For consistency and to avoid platform-dependent behavior, it's better to explicitly specify the encoding as
utf-8when calling.encode().