# README
package crypt
Function | Comment |
---|---|
func NewBcrypt() Bcrypt | creates an bcrypt handler |
func (b *bcryptProperties) Encrypt(plainText string) (string, error) | encrypt plaintext |
func (b *bcryptProperties) HashedText(hashedText string) | set a hashed text string |
func (b *bcryptProperties) PlainText(plainText string) | set a plain text string |
func (b *bcryptProperties) Cost(cost int) | sets bcrypt costs |
func (b *bcryptProperties) Compare() bool | checks the hash against the plaintext |
func GenerateEd25519KeyFiles(dir string, filename string) (string, error) | generates ed25519 key files (id_ed25519 and id_ed25519.pub) |
func NewEncryptedString(plainTextValue string) EncryptedString | creates an Encrypted string |
func NewDecryptedString(encryptedValue string) string | decrypt an encrypted string |
func (v EncryptedString) Value() string | returns the decrypted plainTextValue |
func (v EncryptedString) String() string | returns the decrypted plainTextValue |
func (v EncryptedString) MarshalText() ([]byte, error) | |
func (v *EncryptedString) UnmarshalText(text []byte) error | |
func (v EncryptedString) MarshalBinary() ([]byte, error) | |
func NewSymmetricEncryption() *SymCrypt | creates an SymCrypt handler |
func (s *SymCrypt) SetKey(key string) *SymCrypt | set an AES key |
func (s *SymCrypt) SetPlainText(plainText string) *SymCrypt | set plain text to encrypt. |
func (s *SymCrypt) GetCypherBase64() string | returns the encrypted data stream as base64 encoded |
func (s *SymCrypt) SetCypherBase64(base64String string) *SymCrypt | set cipher text as base64 string. |
func (s *SymCrypt) GetPlainText() (string, error) | returns the plaintext |
# Functions
GenerateEd25519KeyFiles generates two files id_ed25519 and id_ed25519.pub in directory dir.
NewBcrypt is the main entry point.
NewDecryptedString decrypts an encrypted string.
NewEncryptedString creates a new EncryptedString by encrypting the supplied plainTextValue.
NewSymmetricEncryption is the entry point for AES encryption/decryption and can be used to encrypt a string and get the result as base64 string.
# Structs
EncryptedString is a sym crypt string.
SymCrypt is the main structure for symmetric encryption and holds plainText, key and cipher as unexported fields.
# Interfaces
Bcrypt is the main interface.