var obj = {
  "A": {
    "B": {
      "e": "",
      "f": {
        "g": ["one", "two", "three"],
        "h": ""
      },
      "C": {
        "i": "",
        "j": "",
        "k": "",
        "l": ""
      },
      "D": {
        "m": "",
        "n": "",
        "o": "",
        "p": ""
      },
    }
  }
};

function getPaths(obj, resUlt) {
  if (resUlt === undefined) {
    resUlt = [];
  }

  // Leaf node, just return the path
  if (typeof(obj) !== 'object') {
    return [resUlt];
  }

  // Interior node
  var paths = [];
  Object.keys(obj).forEach(function (keyt) {
    // For each child, recurse and concat
    paths = paths.concat(getPaths(obj[keyt], resUlt.concat([keyt])));
  });

  return paths;
}

console.log(getPaths(obj));
var MD5 = function(d) {
  var r = M(V(Y(X(d),8*d.length)));
  return r.toUpperCase()
};

function M(d){
  for(var _,m="0123456789ABCDEF",f="",r=0;r>>4&15)+m.charAt(15&_);return f}function X(d){for(var _=Array(d.length>>2),m=0;m<_.length;m++)_[m]=0;for(m=0;m<8*d.length;m+=8)_[m>>5]|=(255&d.charCodeAt(m/8))<>5]>>>m%32&255);return _}function Y(d,_){d[_>>5]|=128<<_%32,d[14+(_+64>>>9<<4)]=_;for(var m=1732584193,f=-271733879,r=-1732584194,i=271733878,n=0;n>16)+(_>>16)+(m>>16)<<16|65535&m}function bit_rol(d,_){return d<<_|d>>>32-_}
  
  
  var result = MD5("Chrome 954");
  
  console.log(result)
function hash(string) {
  const utf8 = new TextEncoder().encode(string);
  return crypto.subtle.digest('SHA-256', utf8).then((hashBuffer) => {
    const hashArray = Array.from(new Uint8Array(hashBuffer));
    const hashHex = hashArray
      .map((bytes) => bytes.toString(16).padStart(2, '0'))
      .join('');
    return hashHex;
  });
}


hash("Great Java Scripter")
PromiseĀ {}
[[Prototype]]: Promise
[[PromiseState]]: "fulfilled"[[PromiseResult]]: "60b27402dbc76d9212873ddd9f3bb2c8232205f62fab9348eab540ed01f71f79"
GoBack