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