Trying to create an iota transaction bundle in C

I am trying to create an iota transaction bundle in C for Arduino devices and created therefore a github repository:

The code is compiling successfully, however the Arduino is making some encrypted outputs that doesn't make any sense. I am not able to limit the problem to one file, due to lack of knowladge in c. I suspect that the problem could be in the following files:

kerl.h, kerl.c, conversion.h, conversion.c

I hope you can help me with this problem. Thanks for any help in advance.

PS: I am using the Arduino IDE to compile the code. I think it could be a pointer/stack problem?

however the Arduino is making some encrypted outputs that doesn't make any sense.

The code does something that you have woefully-inadequately defined. What does it REALLY do?

You expect it to do something that you have kept a secret. That doesn't work here.

I think it could be a pointer/stack problem?

Why do you think that?

First of all thank you for your reply.

I am trying to get something that is so called "bundle hash bundle". It looks like the following:

Transaction object:
{
"hash": "FOUXA9MWUAETQRWDMZ9CWFX9FBGSOIYD9TCTJBDYKLFSGWGEIAQKBVAXMLSAALBPSZPBMDJF9KTLDX999",
"signatureMessageFragment": "999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999",
"address": "CNBDVRFPLTZDCONTTLIWHPQANGLIDSTAZDLFVRJEJE9CJVUCXNAFSWASGZWGXKAURXEDPINCVUTVZHFSC",
"value": 9999629,
"obsoleteTag": "999999999999999999999999999",
"timestamp": 1527598532,
"currentIndex": 3,
"lastIndex": 3,
"bundle": "MJYOZGDEVIQKZPXPVJFCWGRESRGXVGOEJEZHQLKVSPSLOE9OLFROGCEUURKZDYIGFKIIPKDLXFJPGTHNZ",
"trunkTransaction": "DARJFGSEOHSMZKCHUVRKGOCVBFA9NTIMVPIPQACKJIYSFOVUTWOWHY9GOELYRWEVFFDPNTVPHCHIFW999",
"branchTransaction": "ICRKPKSIVZHURDPSPJGWNCWCCAENRDZDNVYQPCEAIYOXGVDYUTV9BIUHXL9DDWIQJAYQXQUTLVBMA9999",
"tag": "999999999999999999999999999",
"attachmentTimestamp": 1527598533627,
"attachmentTimestampLowerBound": 0,
"attachmentTimestampUpperBound": 3812798742493,
"nonce": "WZ999I999999999999999999999"
}

Transaction object converted into trytes:
999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999CNBDVRFPLTZDCONTTLIWHPQANGLIDSTAZDLFVRJEJE9CJVUCXNAFSWASGZWGXKAURXEDPINCVUTVZHFSCQYAVSA999999999999999999999999999999999999999999999999KFALLYD99C99999999C99999999MJYOZGDEVIQKZPXPVJFCWGRESRGXVGOEJEZHQLKVSPSLOE9OLFROGCEUURKZDYIGFKIIPKDLXFJPGTHNZDARJFGSEOHSMZKCHUVRKGOCVBFA9NTIMVPIPQACKJIYSFOVUTWOWHY9GOELYRWEVFFDPNTVPHCHIFW999ICRKPKSIVZHURDPSPJGWNCWCCAENRDZDNVYQPCEAIYOXGVDYUTV9BIUHXL9DDWIQJAYQXQUTLVBMA9999999999999999999999999999999ROYDZ9AKE999999999MMMMMMMMMWZ999I999999999999999999999
Transaction object trytes length: 2673
Transaction object timestamp: 29 May 2018 12:55:32

but everything that i get from the serial.println is a reversed questionmark. The main funktion is the "transaction.ino" if you like you can test it yourself.

"Why do you think that?"

because I read online that there appears some encrypted outputs if you have some pointer or stack issues.

Transaction object trytes length: 2673

Are you really trying to store 2673 bytes in SRAM at one time? Or more? On which Arduino?

tryte_t bundle_hash_out[10];

where is the end of the array?

for(int i = 0; i<100; i++)
{
  Serial.print(bundle_hash_out[i]);
}

what happens when you go past the end of the array?

Thank you everybody for helping. I really appreciating it! You are awsome!

I have investigeted more and now I know that the function kerl_absorb_trit (when calling the keccak_update) in the kerl.c isn't working. When I comment the function for testing everything works fine. Maybe I am giving the function wrong values?