• @user54159, sure. But it's not really much. I guess Gordon will do a much better version at some point. This was more for experimentation, quickly hacked together. Due to the fact that xxtea needs to have the data with a size of multiples of 4, this version can only treat strings which do not contain the 0 character. I use it as a padding and also to detect end of string when decoding.

    To include in the makefile put the following before "endif # BOOTLOADER":

    INCLUDE += -I$(ROOT)/libs/xxtea
    WRAPPERSOURCES += libs/xxtea/jswrap_xxtea.c
    
    

    Then you will be able to write something like this in JS:

    var encrypted = XXTEA.encrypt("Hello world!", "asdfghjk12345678");
    var decrypted = XXTEA.decrypt(encrypted, "asdfghjk12345678");
    

    The key needs to be exactly 16 characters, the data can be from 1 to 1024 bytes, because it will be copied to a char buffer.

About

Avatar for Pinnchus @Pinnchus started