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

Generate gravatar hash by replacing md5 with sha256 #1732

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion var/Typecho/Common.php
Original file line number Diff line number Diff line change
Expand Up @@ -852,7 +852,8 @@ public static function gravatarUrl(
}

if (!empty($mail)) {
$url .= md5(strtolower(trim($mail)));
// https://docs.gravatar.com/general/hash/ Replacing md5 with sha256
$url .= hash('sha256', strtolower(trim($mail)));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

如果定义了__TYPECHO_GRAVATAR_PREFIX__,且不支持sha256的话可能就出问题了 🤔

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

我觉得是否可以提供一个参数选择 hash method

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

加参数的话,调用的地方也得加一下。感觉还是用常量定义的好些

}

$url .= '?s=' . $size;
Expand Down