crypt

package
v1.4.7 Latest Latest
Warning

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

Go to latest
Published: May 2, 2023 License: GPL-3.0 Imports: 7 Imported by: 0

Documentation

Overview

Please ensure, that in this package is no logging activated. There wont be console-outputs or other prints, you have to handle the "error", if any, by yourself.

The gocrypt package contains a private variable, this variable stores the default encryption passphrase. Make sure to change the default encryption passphrase if you dont want to specify your own encryption passphrase everytime the encrypt/decrypt functions are called.

Happy Encrypting!

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateRandomPassphrase added in v1.4.3

func CreateRandomPassphrase(length int) string

create a random passphrase for de- and encryption

Parameters:

  • `length` : int > length of the generated passphrase

func Decrypt

func Decrypt(_passphrase, text string) (string, error)

uses the decryption with the given passphrase, returns the decrypted version of "text" or an error

Parameters:

  • `passphrase` : string > contains the string, which is used to decrypt the value of `text`
  • `text` : string > contains the text to decrypt

func DecryptWithDefault

func DecryptWithDefault(text string) (string, error)

uses the decryption with the default passphrase, returns the decrypted version of "text" or an error

Parameters:

  • `text` : string > contains the text to decrypt

func Encrypt

func Encrypt(passphrase, text string) (string, error)

uses the encryption with the given passphrase, returns the encrypted version of "text" or an error

Parameters:

  • `passphrase` : string > contains the string, which is used to encrypt the value of `text`
  • `text` : string > contains the text to encrypt

func EncryptWithDefault

func EncryptWithDefault(text string) (string, error)

uses the encryption with the default passphrase, returns the encrypted version of "text" or an error

Parameters:

  • `text` : string > contains the text to encrypt

func GetDefaultPassphrase

func GetDefaultPassphrase() string

return the Default Encryption Passphrase

func SetDefaultPassphrase

func SetDefaultPassphrase(passphrase string)

set another Default Encryption Passphrase, but remember, if changed, the strings, which were encrypted with the old value cant be decrypted anymore

Parameters:

  • `passphrase` : string > contains the new encryption-passphrase

Types

This section is empty.

Jump to

Keyboard shortcuts

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