bugfix: signature computation was broken for multiline texts

This commit is contained in:
Christian Mueller
2014-02-25 18:13:01 +01:00
parent a0837b70b9
commit 144218ecc2
3 changed files with 4 additions and 4 deletions
+2
View File
@@ -85,6 +85,7 @@ The Signature is the MD5 hash of the following string concatenation:
pid + psk + note pid + psk + note
The signature serves as a proof, that the request is authentic and will be issued by the publisher corresponding to the provided PID. Please note, that _all_ of the values used in the signature computation, should be identical to the values passed with the request itself. The signature serves as a proof, that the request is authentic and will be issued by the publisher corresponding to the provided PID. Please note, that _all_ of the values used in the signature computation, should be identical to the values passed with the request itself.
Ensure, that your note contains only `\\n` symbols as line breaks!
The parameters specifying the theme name and fonts are optional and only impact the URLs returned back. The parameters specifying the theme name and fonts are optional and only impact the URLs returned back.
@@ -126,6 +127,7 @@ The Signature is the MD5 hash of the following string concatenation:
pid + psk + noteID + note + password pid + psk + noteID + note + password
Please note, that all of the values used in the signature computation, should be identical to the values passed with the request itself. Please note, that all of the values used in the signature computation, should be identical to the values passed with the request itself.
Ensure, that your note contains only `\\n` symbols as line breaks!
The response of the server will contain the fields `longURL`, `shortURL`, `status`. The response of the server will contain the fields `longURL`, `shortURL`, `status`.
+1 -3
View File
@@ -5,9 +5,7 @@ var timerDelay = iosDetected ? 800 : 400;
var show = function(elem) { elem.style.display = "block" } var show = function(elem) { elem.style.display = "block" }
var $note, $action, $preview, $plain_password, $input_elems, $dashed_line, updatePreview; var $note, $action, $preview, $plain_password, $input_elems, $dashed_line, updatePreview;
var md5 = function (input) { var md5 = hex_md5;
return hex_md5(input.replace(/[\n\r]/g, ""));
}
function md2html(input){ function md2html(input){
return marked(input); return marked(input);
+1 -1
View File
@@ -9,7 +9,7 @@
(defn sign (defn sign
"Returns the MD5 hash for the concatenation of all passed parameters" "Returns the MD5 hash for the concatenation of all passed parameters"
[& args] [& args]
(let [input (apply str args)] (let [input (sreplace (apply str args) #"\r*" "")]
(do (.reset md5Instance) (do (.reset md5Instance)
(.update md5Instance (.getBytes input)) (.update md5Instance (.getBytes input))
(apply str (apply str