Home AMX User Forum AMX General Discussion

AES functions?

Has anyone written / is willing to share any AES functions for NetLinx?

If not (and maybe even if so - I need to start working on this now) I'll work on an AES library for NetLinx.

EDIT: I'm working on it. Encryption is done (128,192,256 bits).

Comments

  • truetrue Posts: 307
    I'm done. This is set up for inclusion in the NCL but I haven't pushed it up yet. I haven't tested the implementation for speed nor have I done any optimization.

    Attached is a sample project of AES in ECB mode (everything should be included, let me know if it isn't).

    In debugger, watch the variables "source" "result" and "operation" and play around with it to see it in action. You can also watch "aes_key" and "aes_bits" to change your key and key bit size, respectively.

    Supports 128, 192 and 256 bit keys, 128 bit blocks only (as is AES standard).
  • ColzieColzie Posts: 470
    Thanks for posting this...however I'm not getting the same results when I compare to an online AES tool.

    For example "Hello World" as input to your code returns
    71 32 73 3C 4E 36 A4 4D 27 4D 40 08 09 1D 24 F3

    but online (function:AES, Mode:ECB, using your key) returns
    01 02 03 04 87 66 43 82 12 34 56 7A DD EE FF 00

    What am I missing something? I'd love to be able to use this.
  • JasonSJasonS Posts: 229
    What kind of execution speed are you guys getting? I implemented AES 256 from fips-197 but I abandoned it because it was too slow. My encode/decode times for one block were above a minute. In duet it is in the millisecond range.
  • ColzieColzie Posts: 470
    I only tested the code that true posted. It was set up to run the algorithm every 10 seconds and the results appeared in the debugger what seemed like right away (within the 10 seconds) when entering new values to encode.
  • truetrue Posts: 307
    The online version is wrong - if you notice, it basically returns the key!

    Speed might not be as fast as Duet but it isn't particularly slow either...I wouldn't do bulk storage with for example.
  • I wonder if anybody of you has written a Duet code for encrypt plain test in AES 128bit.
    Can you share that code?
    Thank you
    Fabrizio L
  • JasonSJasonS Posts: 229
    Encryption is fairly easy to achieve in Duet. Many people, myself included, have used the Bouncy Castle libraries in the past. I no longer have access to Cafe Duet, so I am not familiar with what is available in the NX processors.
  • Thanks for your quick reply.
    NX processors run the same Duet code as NI processors, so the same .jar would run on NX masters.
    Thank you
  • JasonSJasonS Posts: 229
    They run the same Duet code but the underlying system libraries are new. There might be access to built-in encryption libraries now.
Sign In or Register to comment.