Coder Social home page Coder Social logo

xxtea-objc's People

Contributors

andot avatar mengpeilee 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

Watchers

 avatar  avatar  avatar  avatar

xxtea-objc's Issues

crash occurs when text is an empty string

For example,for the following cases, a crash will occur

        NSString *text = @"";
        NSString *key = @"key";
        
        for (int i = 0; i < 10000; i++) {
            NSString *encrypt_data = [XXTEA encryptStringToBase64String:text stringKey:key];
            NSString *decrypt_data = [XXTEA decryptBase64StringToString:encrypt_data stringKey:key];
            NSLog(@"%@", encrypt_data);
            NSLog(@"%d",i);
            if ([text isEqual:decrypt_data]) {
                NSLog(@"success!");
            }
            else {
                NSLog(@"fail!");
            }
        }

stack buffer overflow!!!

Hi, 小马哥,我在使用的时候崩溃了,是这个 FIXED_KEY 宏 导致的,报了 stack buffer overflow detected 的错误,原因是我的 key超过了16位 了,memcpy 的时候就溢出了;因此需要做下调整,这是我修改的:

#define FIXED_KEY \
    size_t i;\
    uint8_t fixed_key[16];\
    size_t cpyLength = key.length > 16 ? 16 : key.length;\ 
    memcpy(fixed_key, key.bytes, cpyLength);\
    for (i = cpyLength; i < 16; ++i) fixed_key[i] = 0;\

关于针对空串的加密解密

你好,我上次反馈了xxtea-objc对空串的加密有crash的风险
链接如下
#2
目前crash的问题是修复了,但是该库对空串的加密解密与其它端不一致了,我对比了一下java的实现与h5的实现,其它端对空串的加密结果是空串,对空串的解密结果也是空串,但是目前xxtea-objc不是,
xxtea-objc则是无论什么秘钥,空串的加密结果都是AAAAAA==

我想不管是什么语言,这种边界case的处理结果也应该保持一致吧?

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.