GithubHelp home page GithubHelp logo

xxtea-go's People

Contributors

andot avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

xxtea-go's Issues

php - go 解密时出错

package main

import (
        "encoding/base64"
        "github.com/xxtea/xxtea"
        "log"
)

var (
        key = []byte("testKey123456789")
        cipher = []byte("马年行大运!")
)

func main() {
        // encrypt and base64 encode
        encCipher := xxtea.Encrypt(cipher, key)
        encCipherBase64 := base64.StdEncoding.EncodeToString(encCipher)
        log.Println(encCipherBase64)

        // base64 decode and decrypt
        byteCipher, _ := base64.StdEncoding.DecodeString(encCipherBase64)
        src := string(xxtea.Decrypt(byteCipher, key))
        log.Println(src)
}

这个在go里面加解密没问题, 把 encCipherBase64 发给 php, base64解码后的数据也一致, 但是 php xxtea解密失败, 没有得到密文.

反之, php 里面加解密也没问题, 把 base64 编码的加密后的数据发给go 进行base64解码, 数据也一致, 但是 go xxtea解密也失败, 得到空白密文.

echo base64_encode(xxtea_encrypt('恭喜发财,马年一切顺利!','testKey123456789'));
//echo xxtea_decrypt(base64_decode(base64_encode(xxtea_encrypt('恭喜发财,马年一切顺利!','testKey123456789'))),'testKey123456789');

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.