You're Invited: Meet the Socket team at BSidesSF and RSAC - April 27 - May 1.RSVP
Socket
Sign inDemoInstall
Socket

github.com/b2camp/go-cryptography

Package Overview
Dependencies
Alerts
File Explorer
Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

github.com/b2camp/go-cryptography

v0.0.0-20241127034327-98992d292bb5
Source
Go
Version published
Created
Source

Cryptography Examples in Go

This repository contains examples demonstrating various cryptographic algorithms implemented in Go. The examples cover encryption, decryption, hashing, and digital signature operations using standard libraries and techniques.

Table of Contents

  • Introduction
  • Prerequisites
  • Algorithms and Examples
  • Contributing
  • License

Introduction

Cryptography is the practice of securing communication and data through encoding techniques. This repository showcases various cryptographic algorithms and their practical use cases in Go, such as encryption, hashing, and signing.

Prerequisites

To run these examples, you need:

Algorithms and Examples

1. AES Symmetric Encryption

AES (Advanced Encryption Standard) is a fast and secure symmetric encryption algorithm.

  • Key Size: 128-bit, 192-bit, or 256-bit.
  • Use Case: Data encryption where both parties share the same key.

Example: aes.go

go run aes.go

2. RSA Asymmetric Encryption

RSA (Rivest–Shamir–Adleman) is a public-key cryptosystem for secure data transmission.

  • Key Size: Commonly 2048-bit or 4096-bit.
  • Use Case: Encrypt messages, secure key exchanges.

Example: rsa.go

go run rsa.go

3. Elliptic Curve Cryptography (ECC)

ECC provides efficient cryptography with smaller keys. It's widely used in blockchain and secure communications.

  • Use Case: Generate keys, sign messages, verify signatures.

Example: ecc.go

go run ecc.go

4. Hashing with SHA-256

Generate a SHA-256 hash for message integrity verification.

  • Use Case: Verify data integrity, store secure hashes of passwords.

Example: sha256.go

go run sha256.go

5. HMAC

HMAC (Hash-Based Message Authentication Code) provides message authentication using a shared secret key.

  • Use Case: Verify the authenticity and integrity of messages.

Example: hmac.go

go run hmac.go

6. Base64 Encoding/Decoding

Base64 encoding is used to safely transmit binary data as text.

  • Use Case: Encode binary data into text for storage or transmission.

Example: base64.go

go run base64.go

FAQs

Package last updated on 27 Nov 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts