Skip to content

Commit

Permalink
properly convert hex to base64
Browse files Browse the repository at this point in the history
based on a snippet found at http://stackoverflow.com/q/23190056/
I am not actually sure this is better/more cryptographically sound,
but it feels less of a hack than interpreting the base64 result as a string.
  • Loading branch information
waldyrious committed Mar 23, 2015
1 parent 2427c4c commit 129f971
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion bookmarklet.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@ var base64_sha256 = function a(b) {
for (e = 3; e + 1; e--) {
var y = l[d] >> 8 * e & 255;
i += (16 > y ? 0 : "") + y.toString(16) }
return btoa(i);
// convert hex to base64 (see dandavis's comment here: http://stackoverflow.com/q/23190056)
return btoa(i.match(/\w{2}/g).map(function(a){return String.fromCharCode(parseInt(a, 16));} ).join(""))
};

function pressHashMyPass() {
Expand Down

0 comments on commit 129f971

Please sign in to comment.