src/crypto_browser.js
function(data, encoding) {
      if (encoding == null) {
        encoding = 'hex';
      }
      if (Array.isArray(data)) {
        return data;
      }
      switch (encoding) {
        case 'base64':
          return Gibberish.base64.decode(data);
        case 'hex':
          return Gibberish.h2a(data);
        case 'utf8':
          return Gibberish.s2a(data);
        default:
          throw new Error("Encoding not supported");
      }
    }
function(data, encoding) {
      if (encoding == null) {
        encoding = 'hex';
      }
      if (Array.isArray(data)) {
        return data;
      }
      switch (encoding) {
        case 'base64':
          return Gibberish.base64.decode(data);
        case 'hex':
          return Gibberish.h2a(data);
        case 'utf8':
          return Gibberish.s2a(data);
        default:
          throw new Error("Encoding not supported");
      }
    }
function ( data , encoding ) { if ( encoding == null ) { encoding = 'hex' ; } if ( Array . isArray ( data ) ) { return data ; } switch ( encoding ) { case 'base64' : return Gibberish . base64 . decode ( data ) ; case 'hex' : return Gibberish . h2a ( data ) ; case 'utf8' : return Gibberish . s2a ( data ) ; default : throw new Error ( "Encoding not supported" ) ; } }
Convert data to a Buffer
@param {String|Buffer} data The data to be converted. If a string, must be encoded as hex.
@param {String} [encoding=hex] The format of the data to convert.
@return {Buffer} The data as a Buffer
Convert data to a Buffer