Documentation ¶
Index ¶
- Constants
- Variables
- func Decrypt(key *[KeyLen]byte, data []byte) ([]byte, error)
- func Encrypt(key *[KeyLen]byte, data []byte) ([]byte, error)
- func GenerateSalt() ([]byte, error)
- type Entity
- type PublicKey
- type ScryptConfig
- func (config ScryptConfig) Decrypt(password string, data []byte) ([]byte, error)
- func (config ScryptConfig) Derive(salt []byte, password string) (*[KeyLen]byte, error)
- func (config ScryptConfig) Encode() []byte
- func (config ScryptConfig) Encrypt(password string, data []byte) ([]byte, error)
- func (config ScryptConfig) MemoryRequiredMB() int
- func (config ScryptConfig) String() string
- func (config ScryptConfig) TimeRequiredMS() (int, error)
Constants ¶
View Source
const ( SaltLen = 32 KeyLen = 32 NonceLen = 24 ScryptLen = 24 )
Variables ¶
View Source
var ScryptConfigHigh = ScryptConfig{ N: 1 << uint64(19), R: 8, P: 1, }
ScryptConfigHigh requires 512MB RAM for less than 5 seconds (i7).
View Source
var ScryptConfigLow = ScryptConfig{ N: 1 << uint64(17), R: 8, P: 1, }
ScryptConfigLow requires 128MB RAM for about a second (i7).
View Source
var ScryptConfigMid = ScryptConfig{ N: 1 << uint64(18), R: 8, P: 1, }
ScryptConfigMid requires 256MB RAM for less than 5 seconds (i7).
View Source
var ScryptConfigParanoid = ScryptConfig{ N: 1 << uint64(20), R: 8, P: 1, }
ScryptConfigParanoid requires 1GB RAM for about 5 seconds (i7).
View Source
var ScryptConfigRealtime = ScryptConfig{ N: 1 << uint64(15), R: 8, P: 1, }
ScryptConfigRealtime requires 32MB RAM for under a second (i7).
Functions ¶
func GenerateSalt ¶
Types ¶
type Entity ¶ added in v0.0.2
func CreateEntity ¶ added in v0.0.2
func LoadEntity ¶ added in v0.0.2
func (*Entity) PrivateKey ¶ added in v0.0.2
type PublicKey ¶ added in v0.0.2
type PublicKey struct {
// contains filtered or unexported fields
}
func LoadPublicKey ¶ added in v0.0.2
type ScryptConfig ¶
type ScryptConfig struct { // CPU/memory cost parameter (logN) N uint64 `json:"n"` // block size parameter (octets) R uint64 `json:"r"` // parallelisation parameter (positive int) P uint64 `json:"p"` }
func DecodeScryptConfig ¶
func DecodeScryptConfig(data []byte) (ScryptConfig, error)
func (ScryptConfig) Decrypt ¶
func (config ScryptConfig) Decrypt(password string, data []byte) ([]byte, error)
func (ScryptConfig) Encode ¶
func (config ScryptConfig) Encode() []byte
func (ScryptConfig) Encrypt ¶
func (config ScryptConfig) Encrypt(password string, data []byte) ([]byte, error)
func (ScryptConfig) MemoryRequiredMB ¶
func (config ScryptConfig) MemoryRequiredMB() int
func (ScryptConfig) String ¶
func (config ScryptConfig) String() string
func (ScryptConfig) TimeRequiredMS ¶
func (config ScryptConfig) TimeRequiredMS() (int, error)
Click to show internal directories.
Click to hide internal directories.