Code Monkey home page Code Monkey logo

cape's People

Contributors

colinta avatar gioblu avatar ivankravets avatar per1234 avatar pharap avatar valeros 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

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

cape's Issues

Change key once program is running

Is there a means of changing the key once the program is running that uses the Cape library? I have the instantiation working fine, but wish to change keys periodically for security reasons without aneed to restart and find a means to load a new key at start up.

Thanks.

esp8266 support

Looks like a useful and simple library and ESP8266 is lacking basic crypto tools.
Any chance to make the library compatible with ESP8266?

Once I try to compile, I get the following warning:

WARNING: library Cape claims to run on [avr] architecture(s) and may be incompatible with your current board which runs on [esp8266] architecture(s).

And then, a bunch of errors related to the swap macro.

Decrypt on linux server

I'm looking for a way to encrypt a string which I then POST to a remote server. This looks like a good start but is there a way that I can decrypt the string once I have it on a remote server?

Cape.py not available

Ho does anyone know how could ai retreive the python version of this library.
I was intending to communicate a microcontroller with a raspberry pi sort of securely by using this library.
I have it working on the microcontroller end but the raspberry is using python and the repo
https://github.com/colinta/Cape.py is not available right now.
Thank you so much

New encryption algorithm

Being the present algorithm weak, It would be cool to discuss about the next iteration, and educational to develop a new algorithm to see how much better can perform if analyzed by great experts.

I am still taken developing examples showing how the present algorithm can be easily broken also if the code is run on small microcontrollers like the Arduino UNO, but feel free to share your point of view.

Thank you for your support :)

Maximum strength

Is there a limit on strength? If I run example with strength=10 decode message is not 0K

First byte not getting encrypted correctly

If you output index on line Cape.cpp:83

Serial.println(i % _key_length - 1);

You will see that for first i there is always -1 which means that _key[i % _key_length - 1] is undefined/unset, therefore data is not encrypted correctly.

p.s.: I decided to go ahead and implement my own version of cipher because there was just to many differences and modifications for my specific project (constantly changing encryption key, optional use of vector,...). But I will keep my eye on this project because I'm working on another project which is more suitable for this implementation.

inverted question mark in serial Monitor

I was tweaking the Serial Hash code (removed the random function of key and salt). Upon running the code my Serial Monitor output is like this,

image.

I tried to take serial output in tera term, and my output like this,
image

I tried changing the baud rate, but it's no use.

Works fine with other key/salt/message combination.

image

Any Suggestion/Advice would be helpful. TIA

Should the encoded initialisation vector be moved to the start?

I've been thinking.

The iv has to be recovered before the data can be decrypted, but at the moment it's at the end of the data - so the last byte has to be read before the first byte, which is inefficient.

If the iv was moved to the start of the encrypted data, then decrypting might be more efficient because the whole operation would then be one traversal through the data instead of skipping to the end and then backtracking.

(It would also allow more efficient implementations in languages that use (one-way) streams or iterators.)

Separate encrypt/decrypt

Hi, so I continue my work using you script and I hit a problem. I'm not 100% this is an issue, because the logic changed and I'm still trying to wrap my head around the code. So here we go:

I prepared a simple script which:

  • encrypts 2bytes (0xAA 0xEE)

  • uses 10 iterations

    #include <Cape.h>
    Cape cape("oEpHgSPFvZ6TzrzkaKMX", 10);
    
    #define DO_ENCRYPT 1
    #define DO_DECRYPT 1
    
    void setup() {
      Serial.begin(115200);
    }
    
    void loop() {
    
    #if DO_ENCRYPT
      char in[] = {0xAA, 0xEE};
    
      cape.encrypt(in, 2);
      byte enPacket_1 = cape.result[0];
      byte enPacket_2 = cape.result[1];
      byte enPacket_3 = cape.result[2];
    
      Serial.print("0x");
      Serial.print(enPacket_1, HEX);
      Serial.print(" | ");
      Serial.print(enPacket_2, HEX);
      Serial.print(" | ");
      Serial.println(enPacket_3, HEX);
    
      delay(1000);
    #endif
    
    #if DO_DECRYPT
      char out[] = {enPacket_1, enPacket_2, enPacket_3};
      //char out[] = {0xC9, 0xE2, 0x3B};
    
      cape.decrypt(out, 2);
      byte dePacket_1 = cape.result[0];
      byte dePacket_2 = cape.result[1];
    
      Serial.print("0x");
      Serial.print(dePacket_1, HEX);
      Serial.print(" | ");
      Serial.println(dePacket_2, HEX);
    
      delay(1000);
    #endif
    
    }

Steps

  1. If I set DO_ENCRYPT 1 and DO_DECRYPT 1 I get this

    0xC1 | EA | 33
    0xAA | EE
    0x81 | AA | 73
    0xAA | EE
    0x5B | 70 | A9
    0xAA | EE
    0x17 | 3C | E5
    0xAA | EE
    0xDF | F4 | 2D
    0xAA | EE
    0xEF | C4 | 1D
    0xAA | EE
    0xAB | 80 | 59
    0xAA | EE
    

    which is correct.

  2. Then I set set DO_ENCRYPT 1 and DO_DECRYPT 0 and I get this

    0xC1 | EA | 33
    0x9 | 22 | FB
    0x15 | 3E | E7
    0xAB | 80 | 59
    0xEB | C0 | 19
    0x23 | 8 | D1
    0x3B | 10 | C9
    0x7B | 50 | 89
    
  3. I then:

    • select one of the (encrypted) values (lets say 0xAB 80 59) and I replace char out[] with this values like so char out[] = {0xAB, 0x80, 0x59};
    • set DO_ENCRYPT 0 and DO_DECRYPT 1
      and I get this
    0xF3 | B7
    0xB6 | F2
    0xB6 | F2
    0xB6 | F2
    0xB6 | F2
    

Problem

Any ideas why data is not decrypted to the same value. As far I understand 3th byte is initialization byte which just "mangles" data.

Versioning is not compatible with the Arduino IDE

Missing minor, and not being full semver the actual versioning make the library not compatible with the Arduino IDE library registry. It obviously would be nice to be part of the libraries listed there. I see it is possible to edit the version number related to a certain release and add to each the missing .0, do you think this is a possible solution?

This issue was rised by @Pharap here: #13

Should other programming language implementations be stored in the src dir?

following the discussion present here: #13 as correctly suggested by @Pharap, should be evaluated if to keep Cape ports in the src dir in this repo or create other repos to store them. For me is fine to host the python implementation in the src dir and examples in the examples dir. It should not interfere with the examples listing within the Arduino IDE and could be handy.

If @colinta is ok with that and prefer to leave to me the maintainance, and @Pharap does not see any additional downsides the inclusion of py scripts within this repo should be fine in my opinion.

Let me know what you think about it.

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.