app_crypto

package
v0.0.8 Latest Latest
Warning

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

Go to latest
Published: May 8, 2024 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Cipher

type Cipher struct {
	// contains filtered or unexported fields
}

Cipher represents a cryptographic cipher using the AES (Advanced Encryption Standard) algorithm in CBC (Cipher Block Chaining) mode.

func NewES256

func NewES256(key []byte) (*Cipher, error)

NewES256 creates a new Cipher instance with the specified key for AES encryption. Parameters:

  • key: The encryption key.

Returns:

  • *Cipher: A pointer to the newly created Cipher instance.
  • error: An error if the cipher creation fails.

func (*Cipher) Decrypt

func (c *Cipher) Decrypt(ciphertext []byte) ([]byte, error)

Decrypt decrypts the given ciphertext using the AES-CBC decryption algorithm. Parameters:

  • ciphertext: The ciphertext to decrypt.

Returns:

  • []byte: The decrypted plaintext.
  • error: An error if decryption fails.

func (*Cipher) Encrypt

func (c *Cipher) Encrypt(plaintext []byte) ([]byte, error)

Encrypt encrypts the given plaintext using the AES-CBC encryption algorithm. Parameters:

  • plaintext: The plaintext to encrypt.

Returns:

  • []byte: The encrypted ciphertext.
  • error: An error if encryption fails.

type Crypto

type Crypto struct {
	// contains filtered or unexported fields
}

func NewCrypto

func NewCrypto(key string) *Crypto

func (*Crypto) ComputeSHA1HMAC

func (c *Crypto) ComputeSHA1HMAC(data ...string) string

ComputeSHA1HMAC : encrypt to SHA1HMAC input key, data String. Output to String

func (*Crypto) ComputeSHA256HMAC

func (c *Crypto) ComputeSHA256HMAC(data ...string) string

func (*Crypto) ComputeSHA512HMAC

func (c *Crypto) ComputeSHA512HMAC(data ...string) string

func (*Crypto) DecodeBASE64

func (c *Crypto) DecodeBASE64(text string) (string, error)

DecodeBASE64 : Decrypt Base64. Input string, output string

func (*Crypto) EncodeBASE64

func (c *Crypto) EncodeBASE64(text string) string

EncodeBASE64 : Encrypt to Base64. Input string, output string

func (*Crypto) EncodeBASE64URL

func (c *Crypto) EncodeBASE64URL(text string) string

EncodeBASE64URL : Encrypt to Base64URL. Input string, output text

func (*Crypto) EncodeDES

func (c *Crypto) EncodeDES(text string) (cipher.Block, error)

EncodeDES : Encrypt to DES. input string, output chiper

func (*Crypto) EncodeMD5

func (c *Crypto) EncodeMD5(text string) string

EncodeMD5 : encrypt to MD5 input string, output to string

func (*Crypto) EncodeMD5Base64

func (c *Crypto) EncodeMD5Base64(text string) string

func (*Crypto) EncodeSHA1HMAC

func (c *Crypto) EncodeSHA1HMAC(data ...string) string

EncodeSHA1HMAC : encrypt to SHA1HMAC input key, data String. Output to String in Base16/Hex format

func (*Crypto) EncodeSHA1HMACBase64

func (c *Crypto) EncodeSHA1HMACBase64(data ...string) string

EncodeSHA1HMACBase64 : encrypt to SHA1HMAC input key, data String. Output to String in Base64 format

func (*Crypto) EncodeSHA256

func (c *Crypto) EncodeSHA256(text string) string

EncodeSHA256: Encrypt to SHA256. input string, output text

func (*Crypto) EncodeSHA256HMAC

func (c *Crypto) EncodeSHA256HMAC(data ...string) string

func (*Crypto) EncodeSHA256HMACBase64

func (c *Crypto) EncodeSHA256HMACBase64(data ...string) string

func (*Crypto) EncodeSHA512

func (c *Crypto) EncodeSHA512(text string) string

EncodeSHA512 Encrypt to SHA512. input string, output text

func (*Crypto) EncodeSHA512HMAC

func (c *Crypto) EncodeSHA512HMAC(data ...string) string

func (*Crypto) EncodeSHA512HMACBase64

func (c *Crypto) EncodeSHA512HMACBase64(data ...string) string

Jump to

Keyboard shortcuts

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