Skip to content

Commit

Permalink
Update CommentPublicQueryServiceImpl.java
Browse files Browse the repository at this point in the history
  • Loading branch information
cryptochecktool authored Nov 28, 2024
1 parent ee0f2e0 commit 8ad7ae8
Showing 1 changed file with 7 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
import java.util.HashMap;
import java.util.Optional;
import java.util.function.Function;
import com.google.common.hash.Hashing;
import lombok.RequiredArgsConstructor;
import org.apache.commons.lang3.BooleanUtils;
import org.apache.commons.lang3.StringUtils;
Expand Down Expand Up @@ -172,7 +173,9 @@ private Mono<? extends CommentVo> filterCommentSensitiveData(CommentVo commentVo
specOwner.setName("");
var email = owner.getEmail();
if (StringUtils.isNotBlank(email)) {
var emailHash = DigestUtils.sha256DigestAsHex(email.getBytes());
var emailHash = Hashing.sha256()
.hashString(email, java.nio.charset.StandardCharsets.UTF_8)
.toString();
if (specOwner.getAnnotations() == null) {
specOwner.setAnnotations(new HashMap<>(2));
}
Expand Down Expand Up @@ -224,7 +227,9 @@ private Mono<? extends ReplyVo> filterReplySensitiveData(ReplyVo replyVo) {
specOwner.setName("");
var email = owner.getEmail();
if (StringUtils.isNotBlank(email)) {
var emailHash = DigestUtils.sha256DigestAsHex(email.getBytes());
var emailHash = Hashing.sha256()
.hashString(email, java.nio.charset.StandardCharsets.UTF_8)
.toString();
if (specOwner.getAnnotations() == null) {
specOwner.setAnnotations(new HashMap<>(2));
}
Expand Down

0 comments on commit 8ad7ae8

Please sign in to comment.