jo

package module
v0.0.0-...-3674bf5 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 1, 2019 License: MIT Imports: 12 Imported by: 0

README

jo

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNilData    = errors.New("jo: Pass or Hash cannot be nil")
	ErrMismatched = errors.New("jo: No match found")
)
View Source
var Kdf_HashAlg_name = map[int32]string{
	0: "SHA256",
	1: "SHA512",
	2: "SHA3_224",
	3: "SHA3_256",
	4: "SHA3_384",
	5: "SHA3_512",
}
View Source
var Kdf_HashAlg_value = map[string]int32{
	"SHA256":   0,
	"SHA512":   1,
	"SHA3_224": 2,
	"SHA3_256": 3,
	"SHA3_384": 4,
	"SHA3_512": 5,
}

Functions

func CompareHashAndPassword

func CompareHashAndPassword(hash, pass []byte) error

func New

func New(pass []byte, opts ...Option) ([]byte, error)

Types

type Kdf

type Kdf struct {
	Salt                 []byte      `protobuf:"bytes,1,opt,name=salt,proto3" json:"salt,omitempty"`
	Key                  []byte      `protobuf:"bytes,2,opt,name=key,proto3" json:"key,omitempty"`
	KeyLen               int64       `protobuf:"varint,3,opt,name=key_len,json=keyLen,proto3" json:"key_len,omitempty"`
	Iter                 int64       `protobuf:"varint,4,opt,name=iter,proto3" json:"iter,omitempty"`
	Alg                  Kdf_HashAlg `protobuf:"varint,5,opt,name=alg,proto3,enum=jo.Kdf_HashAlg" json:"alg,omitempty"`
	XXX_NoUnkeyedLiteral struct{}    `json:"-"`
	XXX_unrecognized     []byte      `json:"-"`
	XXX_sizecache        int32       `json:"-"`
}

func (*Kdf) Descriptor

func (*Kdf) Descriptor() ([]byte, []int)

func (*Kdf) GetAlg

func (m *Kdf) GetAlg() Kdf_HashAlg

func (*Kdf) GetIter

func (m *Kdf) GetIter() int64

func (*Kdf) GetKey

func (m *Kdf) GetKey() []byte

func (*Kdf) GetKeyLen

func (m *Kdf) GetKeyLen() int64

func (*Kdf) GetSalt

func (m *Kdf) GetSalt() []byte

func (*Kdf) ProtoMessage

func (*Kdf) ProtoMessage()

func (*Kdf) Reset

func (m *Kdf) Reset()

func (*Kdf) String

func (m *Kdf) String() string

func (*Kdf) XXX_DiscardUnknown

func (m *Kdf) XXX_DiscardUnknown()

func (*Kdf) XXX_Marshal

func (m *Kdf) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*Kdf) XXX_Merge

func (m *Kdf) XXX_Merge(src proto.Message)

func (*Kdf) XXX_Size

func (m *Kdf) XXX_Size() int

func (*Kdf) XXX_Unmarshal

func (m *Kdf) XXX_Unmarshal(b []byte) error

type Kdf_HashAlg

type Kdf_HashAlg int32
const (
	Kdf_SHA256   Kdf_HashAlg = 0
	Kdf_SHA512   Kdf_HashAlg = 1
	Kdf_SHA3_224 Kdf_HashAlg = 2
	Kdf_SHA3_256 Kdf_HashAlg = 3
	Kdf_SHA3_384 Kdf_HashAlg = 4
	Kdf_SHA3_512 Kdf_HashAlg = 5
)

func (Kdf_HashAlg) EnumDescriptor

func (Kdf_HashAlg) EnumDescriptor() ([]byte, []int)

func (Kdf_HashAlg) String

func (x Kdf_HashAlg) String() string

type Option

type Option func(*Kdf)

func WithKeyLen

func WithKeyLen(len int64) Option

WithKeyLen sets the length of the pbkdf2 key

func WithSalt

func WithSalt(salt []byte) Option

WithSalt sets the key salt IMPORTANT! Do not use with WithSaltLen

func WithSaltLen

func WithSaltLen(len int) Option

WithSaltLen sets the length to generate key salt IMPORTANT! Do not use with WithSalt

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL