XXTEA is a fast and secure encryption algorithm.

XXTEA Golang

Introduction

xxtea is a fast and secure encryption algorithm. This project is the Golang implementation of the xxtea encryption algorithm. Refer to the implementation of the xxtea project of Python. The encryption and decryption results are the same as the xxtea project of Python.

version:

xxtea-go xxtea-python
v1.0.0 v1.2.0, v1.3.0, v2.0.0

Installation

go get github.com/yang3yen/xxtea-go

Usage

This module provides seven functions: URandom,Encrypt,Decrypt,EncryptBase64,DecryptBase64,EncryptHex,DecryptHex.

package main

import (
	"bytes"
	"fmt"
	"github.com/yang3yen/xxtea-go/xxtea"
)

func main() {
	data := []byte("xxtea-test-case")
	key, _ := xxtea.URandom(16)

	enc, _ := xxtea.Encrypt(data, key, true, 0)
	dec, _ := xxtea.Decrypt(enc, key, true, 0)
	if bytes.Equal(data, dec) {
		fmt.Println("encrypt success!")
	} else {
		fmt.Println("encrypt fail!")
	}

	encHex, _ := xxtea.EncryptHex(data, key, true, 0)
	decHex, _ := xxtea.DecryptHex(encHex, key, true, 0)
	if bytes.Equal(data, decHex) {
		fmt.Println("encrypt hex success!")
	} else {
		fmt.Println("encrypt hex fail!")
	}

	encB64, _ := xxtea.EncryptBase64(data, key, true, 0)
	decB64, _ := xxtea.DecryptBase64(encB64, key, true, 0)
	if bytes.Equal(data, decB64) {
		fmt.Println("encrypt base64 success!")
	} else {
		fmt.Println("encrypt base64 fail!")
	}
}
Similar Resources

Windows 11 TPM 2.0 and Secure Boot Setup.exe/Registry bypass written in Go.

Win11-Patcher Windows 11 TPM 2.0 and Secure Boot Setup.exe bypass written in Go. Compiling Requires Go (no shit) Requires a version of 7zip that you c

Dec 19, 2022

QR secrets is a cryptographically secure mechanism to store secret data with the highest levels of security and store it on physical paper.

QR secrets is a cryptographically secure mechanism to store secret data with the highest levels of security and store it on physical paper.

QR Secrets QR secrets is a cryptographically secure mechanism to store secret data with the highest levels of security. Incorporating; AES256-GCM-HKDF

Jan 12, 2022

A Go-flavored attempt to reimplement the git-crypt algorithm in native Go

Golang port of git-crypt functionality

Dec 24, 2022

Secure software enclave for storage of sensitive information in memory.

MemGuard Software enclave for storage of sensitive information in memory. This package attempts to reduce the likelihood of sensitive data being expos

Dec 30, 2022

How to systematically secure anything: a repository about security engineering

How to systematically secure anything: a repository about security engineering

How to Secure Anything Security engineering is the discipline of building secure systems. Its lessons are not just applicable to computer security. In

Jan 5, 2023

Secure Remote Password library for Go

go-srp NOTE: This is a port of node-srp to Go. I recommend reading their README for general information about the use of SRP. Installation go get gith

Aug 8, 2022

A Go Library For Generating Random, Rule Based Passwords. Many Random, Much Secure.

A Go Library For Generating Random, Rule Based Passwords. Many Random, Much Secure.

Can Haz Password? A Go library for generating random, rule based passwords. Many random, much secure. Features Randomized password length (bounded). T

Dec 6, 2021

Pokes users on Slack about outstanding risks found by Crowdstrike Spotlight or vmware Workspace ONE so they can secure their own endpoint.

Pokes users on Slack about outstanding risks found by Crowdstrike Spotlight or vmware Workspace ONE so they can secure their own endpoint.

🤖 security-slacker Pokes users on Slack about outstanding risks found by Crowdstrike Spotlight or vmware Workspace ONE so they can secure their own e

Nov 29, 2022

Secure Boot certificates from the Framework Laptop

Framework Laptop UEFI Secure Boot Certificates Source: Extracted from a live machine (FRANBMCP08) Date: 2021-10-21 KEK (Key Exchange Key) This certifi

Dec 8, 2022
Related tags
A simple, modern and secure encryption tool (and Go library) with small explicit keys, no config options, and UNIX-style composability.

age age is a simple, modern and secure file encryption tool, format, and library. It features small explicit keys, no config options, and UNIX-style c

Dec 28, 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
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 6, 2023
SingularityCE is the Community Edition of Singularity, an open source container platform designed to be simple, fast, and secure.

SingularityCE Guidelines for Contributing Pull Request Template Project License Documentation Support Citation SingularityCE is the Community Edition

Jan 5, 2023
A tool for secrets management, encryption as a service, and privileged access management
A tool for secrets management, encryption as a service, and privileged access management

Vault Please note: We take Vault's security and our users' trust very seriously. If you believe you have found a security issue in Vault, please respo

Jan 2, 2023
password manager using age for encryption

page ====== password manager using age (https://age-encryption.org/) for encryption. encrypted secrets are files in the $PAGE_SECRETS/ directory that

May 30, 2022
DockerSlim (docker-slim): Don't change anything in your Docker container image and minify it by up to 30x (and for compiled languages even more) making it secure too! (free and open source)
DockerSlim (docker-slim): Don't change anything in your Docker container image and minify it by up to 30x (and for compiled languages even more) making it secure too! (free and open source)

Minify and Secure Docker containers (free and open source!) Don't change anything in your Docker container image and minify it by up to 30x making it

Dec 27, 2022
ID hashing and Obfuscation using Knuth's Algorithm

ID Obfuscation/Hashing Transformer for Go There are many times when you want to generate obfuscated ids. This package utilizes Knuth's Hashing Algorit

Nov 22, 2022
coyim - a safe and secure chat client
coyim - a safe and secure chat client

CoyIM - a safe and secure chat client CoyIM is a new client for the XMPP protocol. It is built upon https://github.com/agl/xmpp-client and https://git

Dec 7, 2022