code: function pss_mgf1_str(seed, len, hash) {
      var mask = '', i = 0;
  
      while (mask.length < len) {
          mask += hextorstr(hash(rstrtohex(seed + String.fromCharCode.apply(String, [
                  (i & 0xff000000) >> 24,
                  (i & 0x00ff0000) >> 16,
                  (i & 0x0000ff00) >> 8,
                  i & 0x000000ff]))));
          i += 1;
      }
  
      return mask;
  }
docs: PKCS#1 (PSS) mask generation function