// NewPassState returns a new PassState instance
349253
func NewPassState(name string, resultData interface{}) *PassState {
	return &PassState{
		baseInnerState: baseInnerState{
			name: name,
			id:   rand.Int63(),
		},
		Result: resultData,
	}
}
599276
func (n *Narcissus) NewPasswd() (p *Passwd, err error) {
	p = &Passwd{}
	err = n.Parse(p)
	return
}
103922
func NewAccessEntryPassword(salt []byte, kdfParams *KdfParams) (*AccessEntry, error) {
	if len(salt) != 32 {
		return nil, fmt.Errorf("salt should be 32 bytes long")
	}
	return &AccessEntry{
		Type:      AccessTypePass,
		Salt:      salt,
		KdfParams: kdfParams,
	}, nil
}
1292199
func (s *Trust) SetTrustState(v string) *Trust {
	s.TrustState = &v
	return s
}
908650
func NewUserStateWithPassword2(hostname, password string) (*UserState, error) {
	// db index 0, initialize random generator after generating the cookie secret, password
	var connectTo string
	if (password == "") && (strings.Count(hostname, ":") == 0) {
		connectTo = hostname + ":6379"
	} else if strings.Count(hostname, ":") > 0 {
		connectTo = password + "@" + hostname
	} else {
		connectTo = password + "@" + hostname + ":6379"
	}
	// Create a new UserState with database index 0, "true" for seeding the
	// random number generator and host string
	return NewUserState2(0, true, connectTo)
}
527855
func NewUnlockWithPassphrase(g *libkb.GlobalContext, passphrase string) *Unlock {
	return &Unlock{
		Contextified: libkb.NewContextified(g),
		passphrase:   passphrase,
	}
}
835073
func NewActualStateOfWorld() ActualStateOfWorld {
	m := make(map[string]*crdv1.VolumeSnapshot)
	return &actualStateOfWorld{
		snapshots: m,
	}
}
415875
func NewPeerState(peer p2p.Peer) *PeerState {
	return &PeerState{
		peer:   peer,
		logger: log.NewNopLogger(),
		PRS: cstypes.PeerRoundState{
			Round:              -1,
			ProposalPOLRound:   -1,
			LastCommitRound:    -1,
			CatchupCommitRound: -1,
		},
		Stats: &peerStateStats{},
	}
}
831823
func New(endpoints []string, ca, cert, key string) (*Client, error) {
	client := Client{Endpoints: endpoints}

	if ca != "" || cert != "" || key != "" {
		tlsInfo := transport.TLSInfo{
			CertFile:      cert,
			KeyFile:       key,
			TrustedCAFile: ca,
		}
		tlsConfig, err := tlsInfo.ClientConfig()
		if err != nil {
			return nil, err
		}
		client.TLS = tlsConfig
	}

	return &client, nil
}
1297097
func oldPasswordUpgrade(pass string) (string, error) {
	hash1, err := hex.DecodeString(pass)
	if err != nil {
		return "", errors.Trace(err)
	}

	hash2 := auth.Sha1Hash(hash1)
	newpass := fmt.Sprintf("*%X", hash2)
	return newpass, nil
}
282831
func newHTPasswd(rd io.Reader) (*htpasswd, error) {
	entries, err := parseHTPasswd(rd)
	if err != nil {
		return nil, err
	}

	return &htpasswd{entries: entries}, nil
}
1247463
func newAppConnectionState(nativeID, serviceID string, p *pucontext.PUContext, r *http.Request, originalDestination *net.TCPAddr) *connectionState {

	sourceIP := "0.0.0.0/0"
	sourcePort := 0
	if sourceAddress, err := net.ResolveTCPAddr("tcp", r.RemoteAddr); err == nil {
		sourceIP = sourceAddress.IP.String()
		sourcePort = sourceAddress.Port
	}

	return &connectionState{
		stats: &collector.FlowRecord{
			ContextID: nativeID,
			Destination: &collector.EndPoint{
				URI:        r.Method + " " + r.RequestURI,
				HTTPMethod: r.Method,
				Type:       collector.EndPointTypeExternalIP,
				Port:       uint16(originalDestination.Port),
				IP:         originalDestination.IP.String(),
				ID:         collector.DefaultEndPoint,
			},
			Source: &collector.EndPoint{
				Type:       collector.EnpointTypePU,
				ID:         p.ManagementID(),
				IP:         sourceIP,
				Port:       uint16(sourcePort),
				HTTPMethod: r.Method,
				URI:        r.Method + " " + r.RequestURI,
			},
			Action:      policy.Reject,
			L4Protocol:  packet.IPProtocolTCP,
			ServiceType: policy.ServiceHTTP,
			ServiceID:   serviceID,
			Tags:        p.Annotations(),
			PolicyID:    "default",
			Count:       1,
		},
	}
}
624911
func NewLogStreamState(c context.Context, id HashID) *LogStreamState {
	return &LogStreamState{Parent: ds.NewKey(c, "LogStream", string(id), 0, nil)}
}
886321
func NewReceivedTaskState(signature *Signature) *TaskState {
	return &TaskState{
		TaskUUID: signature.UUID,
		State:    StateReceived,
	}
}
1059609
func New(providerName string, options Options, mapper authapi.UserIdentityMapper) (authenticator.Password, error) {
	auth := &Authenticator{
		providerName: providerName,
		options:      options,
		mapper:       mapper,
		identityFactory: &ldaputil.DefaultLDAPUserIdentityFactory{
			ProviderName: providerName,
			Definer:      options.UserAttributeDefiner,
		},
	}
	return auth, nil
}
220062
func NewBatchTaskState(stateName string,
	parameters BatchTaskParameters) *BatchTaskState {

	sns := &BatchTaskState{
		BaseTask: BaseTask{
			baseInnerState: baseInnerState{
				name: stateName,
				id:   rand.Int63(),
			},
		},
		parameters: parameters,
	}
	return sns
}
448592
func NewUsernamePasswordConfig(username string, password string, clientID string, tenantID string) UsernamePasswordConfig {
	return UsernamePasswordConfig{
		Username:    username,
		Password:    password,
		ClientID:    clientID,
		TenantID:    tenantID,
		Resource:    azure.PublicCloud.ResourceManagerEndpoint,
		AADEndpoint: azure.PublicCloud.ActiveDirectoryEndpoint,
	}
}