crypto

package module
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Feb 26, 2024 License: MIT Imports: 3 Imported by: 0

README

crypto

Go Test Go Report Card

crypto provides helper functions that uses standard crypto library.

Installation

Usage

The keys should be the AES key, either 16, 24, or 32 bytes to select AES-128, AES-192, or AES-256.

Encrypt

Encrypt encrypts provided data with provided key using AES.

encrypted, err := crypto.Encrypt(key, decrypted)

MustEncrypt

MustEncrypt calls Encrypt function and panics on errors.

encrypted := crypto.MustEncrypt(key, decrypted)

Decrypt

Decrypt decrypts encrypted data with provided key using AES.

decrypted, err := crypto.Decrypt(key, encrypted)

MustDecrypt

MustDecrypt calls Decrypt function and panics on errors.

decrypted := crypto.MustDecrypt(key, encrypted)

Documentation

Overview

Package crypto provides helper functions that uses standard crypto library.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Decrypt

func Decrypt(key []byte, encrypted []byte) ([]byte, error)

Decrypt decrypts encrypted data with provided key using AES.

func Encrypt

func Encrypt(key []byte, decrypted []byte) ([]byte, error)

Encrypt encrypts provided data with provided key using AES.

func MustDecrypt

func MustDecrypt(key []byte, encrypted []byte) []byte

MustDecrypt calls Decrypt function and panics on errors.

func MustEncrypt

func MustEncrypt(key []byte, decrypted []byte) []byte

MustEncrypt calls Encrypt function and panics on errors.

Types

This section is empty.

Jump to

Keyboard shortcuts

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