...

Source file src/edge-infra.dev/pkg/lib/crypto/crypto.go

Documentation: edge-infra.dev/pkg/lib/crypto

     1  package crypto
     2  
     3  type HashFunction string
     4  
     5  const (
     6  	pbkdf2Type HashFunction = "pbkdf2"
     7  	bcryptType HashFunction = "bcrypt"
     8  	sha512Type HashFunction = "sha512"
     9  )
    10  
    11  func (hf HashFunction) Type() string {
    12  	switch hf {
    13  	case pbkdf2Type:
    14  		return "sha512"
    15  	case bcryptType:
    16  		return "blowfish"
    17  	case sha512Type:
    18  		return "sha512"
    19  	default:
    20  		return ""
    21  	}
    22  }
    23  
    24  type Credential interface {
    25  	Hashed() []byte
    26  	Plain() string
    27  	HashFunction() string
    28  	HashType() string
    29  	Iterations() (int, error)
    30  	Salt() ([]byte, error)
    31  }
    32  
    33  type AsymmetricKeyPair interface {
    34  	PublicKey() string
    35  	PrivateKey() string
    36  }
    37  

View as plain text