radi

package module
v1.1.2 Latest Latest
Warning

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

Go to latest
Published: May 21, 2023 License: MIT Imports: 4 Imported by: 1

README

radi

All what you need to easily work with aes encryption and decryption in golang.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Decrypt

func Decrypt(encryptedPhrase, secreteKey string, iv []byte) (plainPhrase string, err error)

Decrypt extracts the text from the base64 encoded encrypted string using the secrete key and initialization vector used to encrypt the text

plainPhrase - is a plain text extracted from an encrypted text

valid - true if plainPhrase is a valid base64 string. It's false if plainPhrase is not a valid base64 string

func Encrypt

func Encrypt(plainPhrase, secreteKey string, iv []byte) (encryptedPhrase string, err error)

Encrypt encrypts plainPhrase using the given secrete key and initialization vector(iv). Then returns an encrypted base64 URL-encoded string.

func RandBytes

func RandBytes(len int) (randomBytes []byte, err error)

RandBytes generates a random []byte of length len

(Very handy for creating initiliazation vectors but you are not limited to!). It returns any raised error

func RandBytesNoErr added in v1.1.2

func RandBytesNoErr(len int) []byte

RandBytes generates a random []byte of length len

(Very handy for creating initiliazation vectors but you are not limited to!). It doesn't return any error but panics when encounters error

func RandDigits

func RandDigits(len int) (string, error)

RandDigits generates secure random digits(0-9) which can be used for anything from generating OTP to verification codes. It returns any raised error

func RandDigitsNoErr added in v1.1.2

func RandDigitsNoErr(len int) string

RandDigits generates secure random digits(0-9) which can be used for anything from generating OTP to verification codes. It doesn't return any error but panics when encounters error

func RandString

func RandString(len int) (randomString string, err error)

RandString generates a random base64 URL-encoded string of length len. It returns any raised error

func RandStringNoErr added in v1.1.2

func RandStringNoErr(len int) string

RandString generates a random base64 URL-encoded string of length len. It doesn't return any error but panics when encounters error

Types

This section is empty.

Jump to

Keyboard shortcuts

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