s3sign.js
// base64 encodes the result (optionally urlencoding after that).
base64 encodes the result (optionally urlencoding after that).
base64 encodes the result ( optionally urlencoding after that ) .
function encode(secretKey, canonicalString, urlEncode) {
        var crypto;
        if (typeof CryptoJS === "undefined" && typeof require !== "undefined") {
          crypto = require("crypto-js");
        } else {
          crypto = CryptoJS; 
        }
        var hmac = crypto.HmacSHA1(canonicalString, secretKey);
        var b64 = hmac.toString(crypto.enc.Base64);
        if (urlEncode) {
          return encodeURIComponent(canonicalString);
        } else {
          return b64;
        }
      }
function encode ( secretKey , canonicalString , urlEncode ) { var crypto ; if ( typeof CryptoJS === "undefined" && typeof require !== "undefined" ) { crypto = require ( "crypto-js" ) ; } else { crypto = CryptoJS ; } var hmac = crypto . HmacSHA1 ( canonicalString , secretKey ) ; var b64 = hmac . toString ( crypto . enc . Base64 ) ; if ( urlEncode ) { return encodeURIComponent ( canonicalString ) ; } else { return b64 ; } }
base64 encodes the result (optionally urlencoding after that).
base64 encodes the result ( optionally urlencoding after that ) .