About Monkey 2 › Forums › Monkey 2 Code Library › TinyAES Wrapper
Tagged: aes, encryption, tiny
This topic contains 3 replies, has 3 voices, and was last updated by
skn3 1 year, 7 months ago.
-
AuthorPosts
-
September 1, 2017 at 10:08 am #10187
So, I found this “simple” AES encryption for C. Thought I would try and wrap it to Monkey.
https://github.com/kokke/tiny-AES-cClone the git, move aes.c and aes.h into the same folder as this following code. Note: UNTESTED But COMPILED THIS IS WAAY BEYOND MY SCOPE. xD
Monkey123456789101112131415161718Namespace tinyaes#Import "aes.h"#Import "aes.c"Extern'void AES_ECB_encrypt(uint8_t* input, const uint8_t* key, uint8_t* output, const uint32_t length);Function AES_ECB_encrypt:Void(input:UByte Ptr, key:UByte Ptr, output:UByte Ptr, length:UInt)'void AES_ECB_decrypt(const uint8_t* input, const uint8_t* key, uint8_t *output, const uint32_t length)Function AES_ECB_decrypt:Void(input:UByte Ptr, key:UByte Ptr, output:UByte Ptr, length:UInt)'void AES_CBC_encrypt_buffer(uint8_t* output, uint8_t* input, uint32_t length, const uint8_t* key, const uint8_t* iv)Function AES_CBC_encrypt_buffer:Void(output:UByte Ptr, input:UByte Ptr, length:UInt, key:UByte Ptr, iv:UByte Ptr)'void AES_CBC_decrypt_buffer(uint8_t* output, uint8_t* input, uint32_t length, const uint8_t* key, const uint8_t* iv);Function AES_CBC_decrypt_buffer:Void(output:UByte Ptr, input:UByte Ptr, length:UInt, key:UByte Ptr, iv:UByte Ptr)Still not sure how to pass the arguments or even use the library, but it compiles just fine on Windows 10.
I tried using a DataBuffer.Data(Ubyte Ptr) for the data input/output, but that didn’t work. But I’m sure it can be made too just using this module.EDIT: Please see skn3’s version here: LINK
September 6, 2017 at 7:51 pm #10293Great, did you manage to get it working yet?
September 7, 2017 at 8:07 am #10300No, I don’t think I can get it to work given my limited knowledge of the subject. I think I might have to adapt the actual C code to a more Monkey friendly source. I just figured I’d try it out and see if anyone could help. I think Encryption is important. Passing the arguments is my current problem, the compiler transforms a DataBuffer.Data Ptr to a “const char *” which causes problems…
Maybe Mark has a few pointers? Pun intended.September 17, 2017 at 3:34 pm #10583 -
AuthorPosts
You must be logged in to reply to this topic.