An out-of-the-box cryptographic message communication.

message

An out-of-the-box cryptographic message communication.

how to use

1. encript & decript

import(
	"github.com/UedaTakeyuki/message"
)

func encriptAndEncode(plainmessage []byte) (crypticmessage string) {

	// new AESCTR
	m := new(message.AESCTR)

	// set key
	m.SetKey([]byte("01234567890123456789012345678901"))

	// set plainmessage for encription
	m.SetPlainMessage(plainmessage)

	// get criptic message
	crypticmessage = m.GetEncodedEncriptedMessage()
	log.Println("crypticmessage:", crypticmessage)

	return
}

func decodeAndDecript(crypticmessage string) {

	// new AESCTR
	m := new(message.AESCTR)

	// set key
	m.SetKey([]byte("01234567890123456789012345678901"))

	// set criptic message string
	m.SetEncodedEncriptedMessage(crypticmessage)

	// get original message from cryptic message
	decreiptedMessage := m.GetDecriptedMessage()
	log.Println("decreiptedMessage:", string(decreiptedMessage))

}

func main(){
	crypticmessage, mac := encriptAndEncode([]byte(originalMessage))
	decodeAndDecript(crypticmessage, mac)
}

Output message:

crypticmessage: L0z3LU3pmWNUvGr-w1eSzRLZpcuajcjy84Qa4Zq1
decreiptedMessage: some plaintext

2. encript and authenticate & decript and authentication confirm

import(
	  "github.com/UedaTakeyuki/message"
)

func encriptAndEncode(plainmessage []byte) (crypticmessage string, mac string) {

	// new AESCTR
	m := new(message.AESCTR)

	// set key
	m.SetKey([]byte("01234567890123456789012345678901"))

	// set plainmessage for encription
	m.SetPlainMessage(plainmessage)

	// get criptic message
	crypticmessage = m.GetEncodedEncriptedMessage()
	log.Println("crypticmessage:", crypticmessage)

	// get Authentication Code of this message
	mac = m.GetPlainMessageMac()
	log.Println("hmac of plaintext:", mac)

	return
}

func decodeAndDecript(crypticmessage string, mac string) {

	// new AESCTR
	m := new(message.AESCTR)

	// set key
	m.SetKey([]byte("01234567890123456789012345678901"))

	// set criptic message string
	m.SetEncodedEncriptedMessage(crypticmessage)

	// get original message from cryptic message
	decreiptedMessage := m.GetDecriptedMessage()
	log.Println("decreiptedMessage:", string(decreiptedMessage))

	// confirm Authentication Code
	result, _ := m.ConfirmMacFromstring(mac)
	log.Println("Confrimation result is", result)
}

func main(){
	crypticmessage, mac := encriptAndEncode([]byte(originalMessage))
	decodeAndDecript(crypticmessage, mac)
}

Output message:

crypticmessage: L0z3LU3pmWNUvGr-w1eSzRLZpcuajcjy84Qa4Zq1
hmac of plaintext: cdd1aba74001d40e980de7cee69dc10d8495a609936bc835da4b30cb33ab6f50
decreiptedMessage: some plaintext
Confrimation result is true

supported algorithm

  • AES CTR + HMAC (encription: AES CTR, message authentication: HMAC)
  • AESGCM (both encription and message authentication are supported by AES GCM)
Owner
Dr. Takeyuki Ueda
Les rapports de problèmes et les demandes de fonctionnalités sont les bienvenus ! 😁 Issue reports & feature requests are welcome! 😀
Dr. Takeyuki Ueda
Similar Resources

Find out if a tx was uncled

Find out if a tx was uncled (first mined in a block that has been uncled, in which case the tx was sent back to mempool and mined again later). Usage:

Nov 1, 2022

Attempts to make attribute based encryption work, particularly trying out bn256 pairing curve

Attempts to make attribute based encryption work, particularly trying out bn256 pairing curve

EC Pairings over bn256 This is an attempt to solve the core problem of attribute based encryption, where the goal is to be able to use CA-issued attri

Jan 5, 2022

An easy-to-use XChaCha20-encryption wrapper for io.ReadWriteCloser (even lossy UDP) using ECDH key exchange algorithm, ED25519 signatures and Blake3+Poly1305 checksums/message-authentication for Go (golang). Also a multiplexer.

Quick start Prepare keys (on both sides): [ -f ~/.ssh/id_ed25519 ] && [ -f ~/.ssh/id_ed25519.pub ] || ssh-keygen -t ed25519 scp ~/.ssh/id_ed25519.pub

Dec 30, 2022

A markov chain for Discord message dumps using https://github.com/fr3fou/polo

discord-markov-chain A markov chain for Discord message dumps using https://github.com/fr3fou/polo Download If you have a go installed, just clone the

Oct 28, 2022

A simple, secure self-destructing message service, using HashiCorp Vault product as a backend

A simple, secure self-destructing message service, using HashiCorp Vault product as a backend

sup3rS3cretMes5age! A simple, secure self-destructing message service, using Has

Mar 5, 2022

Peer-to-peer encrypted message exchange

Constellation Constellation is a self-managing, peer-to-peer system in which each node: Hosts a number of NaCl (Curve25519) public/private key pairs.

Nov 11, 2022

Tradingview-2-exchange - Place buy/sell orders in exchange(binance) when trading view strategy raise alert message

TradingView-2-Exchange This application is used to place a buy/sell order in Bin

Sep 27, 2022

go-actor is a lightweight message framework using actor model

go-actor go-actor is a lightweight message framework using actor model 初衷 想能在代码逻辑上方便的写无锁的同步rpc调用代码,同时又不会阻塞住其他服务对这个Actor的调用 一个Actor可以有多种身份,想能比较方便的分类管理A

Oct 21, 2022

Zero Trust Network Communication Sentinel provides peer-to-peer, multi-protocol, automatic networking, cross-CDN and other features for network communication.

Zero Trust Network Communication Sentinel provides peer-to-peer, multi-protocol, automatic networking, cross-CDN and other features for network communication.

Thank you for your interest in ZASentinel ZASentinel helps organizations improve information security by providing a better and simpler way to protect

Nov 1, 2022

Prometheus Common Data Exporter can parse JSON, XML, yaml or other format data from various sources (such as HTTP response message, local file, TCP response message and UDP response message) into Prometheus metric data.

Prometheus Common Data Exporter can parse JSON, XML, yaml or other format data from various sources (such as HTTP response message, local file, TCP response message and UDP response message) into Prometheus metric data.

Prometheus Common Data Exporter Prometheus Common Data Exporter 用于将多种来源(如http响应报文、本地文件、TCP响应报文、UDP响应报文)的Json、xml、yaml或其它格式的数据,解析为Prometheus metric数据。

May 18, 2022

Unfancy resources embedding for Go with out of box http.FileSystem support.

Resources Unfancy resources embedding with Go. No blings. No runtime dependency. Idiomatic Library First design. Dude, Why? Yes, there is quite a lot

Oct 19, 2022

Open Service Mesh (OSM) is a lightweight, extensible, cloud native service mesh that allows users to uniformly manage, secure, and get out-of-the-box observability features for highly dynamic microservice environments.

Open Service Mesh (OSM) is a lightweight, extensible, cloud native service mesh that allows users to uniformly manage, secure, and get out-of-the-box observability features for highly dynamic microservice environments.

Open Service Mesh (OSM) Open Service Mesh (OSM) is a lightweight, extensible, Cloud Native service mesh that allows users to uniformly manage, secure,

Jan 2, 2023

⚗ The most advanced CLI template on earth! Featuring automatic releases, website generation and a custom CI-System out of the box.

⚗ The most advanced CLI template on earth! Featuring automatic releases, website generation and a custom CI-System out of the box.

cli-template ✨ ⚗ A template for beautiful, modern, cross-platform compatible CLI tools written with Go! Getting Started | Wiki This template features

Dec 4, 2022

Take control over your live stream video by running it yourself. Streaming + chat out of the box.

Take control over your live stream video by running it yourself.  Streaming + chat out of the box.

Take control over your content and stream it yourself. Explore the docs » View Demo · Use Our Server for Testing · FAQ · Report Bug Table of Contents

Jan 1, 2023

A minimal Go project with user authentication ready out of the box. All frontend assets should be less than 100 kB on every page load

Golang Base Project A minimal Golang project with user authentication ready out of the box. All frontend assets should be less than 100 kB on every pa

Jan 1, 2023

Golang-echo-sample - Make an out-of-the-box backend based on golang-echo

Golang-echo-sample - Make an out-of-the-box backend based on golang-echo

Dec 31, 2021

Issue-mafia - An out-of-the-box CLI that helps you to easily synchronize Git hooks with a remote repository

issue-mafia is an out-of-the-box CLI that helps you to easily synchronize Git hooks with a remote repository.

Feb 14, 2022

Golog is a logger which support tracing and other custom behaviors out of the box. Blazing fast and simple to use.

GOLOG Golog is an opinionated Go logger with simple APIs and configurable behavior. Why another logger? Golog is designed to address mainly two issues

Oct 2, 2022

a lightweight, high-performance, out-of-the-box logging library that relies solely on the Go standard library

English | 中文 olog olog is a lightweight, high-performance, out-of-the-box logging library that relies solely on the Go standard library. Support outpu

Apr 12, 2023
Easy to use cryptographic framework for data protection: secure messaging with forward secrecy and secure data storage. Has unified APIs across 14 platforms.
Easy to use cryptographic framework for data protection: secure messaging with forward secrecy and secure data storage. Has unified APIs across 14 platforms.

Themis provides strong, usable cryptography for busy people General purpose cryptographic library for storage and messaging for iOS (Swift, Obj-C), An

Jan 9, 2023
whirlpool cryptographic hashing library

whirlpool.go A whirlpool hashing library for go Build status Setup $ go get github.com/jzelinskie/whirlpool Example package main import ( "fmt" "

Oct 12, 2022
Cryptographic Addition Chain Generation in Go

Cryptographic Addition Chain Generation in Go addchain generates short addition chains for exponents of cryptographic interest with results rivaling t

Dec 5, 2022
Jan 7, 2023
Pure Go GOST cryptographic functions library.

Pure Go GOST cryptographic functions library. GOST is GOvernment STandard of Russian Federation (and Soviet Union). GOST 28147-89 (RFC 5830) block cip

Aug 10, 2022
goKryptor is a small and portable cryptographic tool for encrypting and decrypting files.

goKryptor goKryptor is a small and portable cryptographic tool for encrypting and decrypting files. This tool supports XOR and AES-CTR (Advanced Encry

Dec 6, 2021
Ekliptic - Primitives for cryptographic operations on the secp256k1 curve, with zero dependencies and excellent performance

Ekliptic This package provides primitives for cryptographic operations on the se

Sep 7, 2022
Interblockchain communication protocol (IBC) implementation in Golang.

ibc-go Interblockchain communication protocol (IBC) implementation in Golang built as a SDK module. Components Core The core/ directory contains the S

Jan 7, 2023
Simple, fast and safe cross-platform linear binary stream communication protocol. AES key exchange based on ecc secp256k1

FFAX Protocol 2 dev 简体中文 Welcome to FFAX Protocol v2 Quick start go get github.com/RealFax/FFAX func example() { listener, err := net.Listen("tcp",

Mar 21, 2022
Boxen - put your network operating systems in a box!

boxen boxen -- put your network operating systems in a box (or if you speak ???? , fight them! ?? )! boxen is a cli tool written in Go that allows you

Nov 26, 2022