Skip to content

Commit

Permalink
Prepend hash method to the hash value and add more test cases
Browse files Browse the repository at this point in the history
Signed-off-by: Gao Binlong <gbinlong@amazon.com>
  • Loading branch information
gaobinlong committed Jun 14, 2024
1 parent 56cc4b6 commit 1f2d5d0
Show file tree
Hide file tree
Showing 2 changed files with 453 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ public IngestDocument execute(IngestDocument document) {
MessageDigest messageDigest = HashMethod.fromMethodName(hashMethod);
assert (messageDigest != null);
messageDigest.update(concatenatedFields.toString().getBytes(StandardCharsets.UTF_8));
document.setFieldValue(targetField, Base64.getEncoder().encodeToString(messageDigest.digest()));
document.setFieldValue(targetField, hashMethod + ":" + Base64.getEncoder().encodeToString(messageDigest.digest()));

return document;
}
Expand Down
Loading

0 comments on commit 1f2d5d0

Please sign in to comment.