diff --git a/src/General/Settings/Sauce.html b/src/General/Settings/Sauce.html
index b52a9f31b..b0e561a09 100644
--- a/src/General/Settings/Sauce.html
+++ b/src/General/Settings/Sauce.html
@@ -10,6 +10,7 @@
%IMG: Full image URL for GIF, JPG, and PNG; thumbnail URL for other types.
%MD5: MD5 hash in base64.
%sMD5: MD5 hash in base64 using - and _.
+ %hMD5: MD5 hash in hexadecimal.
%name: Original file name.
%board: Current board.
%%, %semi: Literal % and ;.
diff --git a/src/Images/Sauce.coffee b/src/Images/Sauce.coffee
index 953a8e33a..9452f0730 100644
--- a/src/Images/Sauce.coffee
+++ b/src/Images/Sauce.coffee
@@ -42,13 +42,14 @@ Sauce =
skip = false
for key of parts
- parts[key] = parts[key].replace /%(T?URL|IMG|s?MD5|board|name|%|semi)/g, (parameter) ->
+ parts[key] = parts[key].replace /%(T?URL|IMG|[sh]?MD5|board|name|%|semi)/g, (parameter) ->
type = {
'%TURL': post.file.thumbURL
'%URL': post.file.url
'%IMG': if ext in ['gif', 'jpg', 'png'] then post.file.url else post.file.thumbURL
'%MD5': post.file.MD5
'%sMD5': post.file.MD5?.replace /[+/=]/g, (c) -> {'+': '-', '/': '_', '=': ''}[c]
+ '%hMD5': if post.file.MD5 then ("0#{c.charCodeAt(0).toString(16)}"[-2..] for c in atob post.file.MD5).join('')
'%board': post.board.ID
'%name': post.file.name
'%%': '%'