cipher

package module
v0.0.0-...-dd2f455 Latest Latest
Warning

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

Go to latest
Published: Jun 2, 2025 License: MIT Imports: 6 Imported by: 0

README

AES-256 GCM Encryption/Decryption Utility

A simple Go package for encrypting and decrypting data using AES-256 in GCM mode.

Features

  • AES-256 encryption with GCM mode (authenticated encryption)
  • SHA-256 key derivation
  • Random nonce generation for each encryption
  • Base64 URL-safe encoding of ciphertext

Usage

package main

import (
    "github.com/GoX7/cipher"
)

func main() {
	key := "your-secret-key-here"
	plaintext := "sensitive data to encrypt"

	// Encrypt
	encrypted, err := cipher.Encrypt(key, []byte(plaintext))
	if err != nil {
		panic(err)
	}

	// Decrypt
	decrypted, err := cipher.Decrypt(key, encrypted)
	if err != nil {
		panic(err)
	}
}

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Decrypt

func Decrypt(key string, cipherText string) (string, error)

func Encrypt

func Encrypt(key string, data []byte) (string, error)

Types

This section is empty.

Jump to

Keyboard shortcuts

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