Skip to content
forked from xxtea/xxtea-go

XXTEA encryption algorithm library for Golang.

License

Notifications You must be signed in to change notification settings

hl-lab/xxtea-go

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 

Repository files navigation

XXTEA for Golang

XXTEA logo

Introduction

XXTEA is a fast and secure encryption algorithm. This is a XXTEA library for Golang.

It is different from the original XXTEA encryption algorithm. It encrypts and decrypts []byte instead of []uint32, and the key is also []byte.

Installation

go get github.com/xxtea/xxtea-go/xxtea

Usage

package main

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

func main() {
    str := "Hello World! 你好,中国!"
    key := "1234567890"
    encrypt_data := xxtea.Encrypt([]byte(str), []byte(key))
    decrypt_data := string(xxtea.Decrypt(encrypt_data, []byte(key)))
    if str == decrypt_data {
        fmt.Println("success!")
    } else {
        fmt.Println("fail!")
    }
}

About

XXTEA encryption algorithm library for Golang.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Go 100.0%