Skip to content
View g-crypt's full-sized avatar
💭
Hello World
💭
Hello World
  • Joined Oct 19, 2024

Block or report g-crypt

Block user

Prevent this user from interacting with your repositories and sending you notifications. Learn more about blocking users.

You must be logged in to block users.

Please don't include any personal information such as legal names or email addresses. Maximum 100 characters, markdown supported. This note will be visible to only you.
Report abuse

Contact GitHub support about this user’s behavior. Learn more about reporting abuse.

Report abuse
g-crypt/README.md

G-Crypt

Simple encryption library in Go using AES-256.

codecov

Installation

To install the package, run the following command:

go get github.com/g-crypt/g-crypt

Or

go install github.com/g-crypt/g-crypt

Usage

Here is an example of how to use the encryption and decryption functions provided by the g-crypt package:

package main

import (
	"fmt"
	gcrypt "github.com/g-crypt/g-crypt"
)

func main() {
    text := "Hello World"
    password := "secret-password"

    // Encrypt the text
    encrypted, err := gcrypt.EncryptAES256(text, password)
    if err != nil {
        fmt.Println("Error encrypting:", err)
        return
    }
    fmt.Println("Encrypted text:", encrypted)

    // Decrypt the text
    decrypted, err := gcrypt.DecryptAES256(encrypted, password)
    if err != nil {
        fmt.Println("Error decrypting:", err)
        return
    }
    fmt.Println("Decrypted text:", string(decrypted))
}

Functions

EncryptAES256

func EncryptAES256(text, password string) (string, error)

Encrypts a text using AES-256.

  • text: The text to be encrypted.
  • password: The password used to generate the encryption key.

Returns the encrypted text in base64 or an error if it occurs.

DecryptAES256

func DecryptAES256(encryptedText, password string) ([]byte, error)

Decrypts a text encrypted using AES-256.

  • encryptedText: The encrypted text in base64.
  • password: The password used to generate the encryption key.

Returns the decrypted text as a byte slice or an error if it occurs.

Popular repositories Loading

  1. g-crypt g-crypt Public

    Simple encryption library in Go using AES-256.

    Go