Thanks everyone.
Type: Posts; User: MrSteve
Thanks everyone.
So it's size will always be 1 (according to sizeof), but I can still use result to store 2 unsigned chars?
Thanks everyone.
slingerland3g:
When I execute the following:
unsigned char *result;
result = malloc(2 * sizeof(unsigned char));
Thank you for the replies.
Do you mean this kind of thing?
unsigned char *result;
// I want my array to store two bytes
result = (unsigned char *) malloc(2);
Hello
Is there any way to dynamically change the size of an array?
For example -
unsigned char result[] = {0x01, 0x01}
// do stuff with result
OK, thanks, at least I now know what to do.
Cheers.
Ah, thank you, that makes sense.
Do you know how I can get sizeof to return the size of the array instead of the pointer?
Thanks.
Hello
I was wondering if any of you have an explanation for this.
int main()
{
unsigned char a[] = {0x00, 0x80, 0x81};
unsigned char b[] = {0x00, 0x18, 0x00};
Thanks Dave.
Thanks for the replies.
Dave_Sinkula: would I be able to perform shifts (e.g. >>) using a bit set?
Hello
I would like to be able to create an array of (for example) 16 or 18 or 40 or 100 bits.
I'm aware I can create an array of unsigned chars and simply use the bits I want from that, but I'd...
Thank you both for your replies.
I'm new to C and cryptorgraphy, so you have both been a great help.
Thanks!
Hello
I am teaching myself encryption using C.
At the moment I'm implementing RSA. I'm only using prime numbers smaller than 1000.
When it comes to encrypting, and especially decrypting, I'm...
Thank you for your reply.
So if I have a text file called plaintext.txt with the following HEX:
0123456789ABCDEF
Should the following code work?
Hello
I've googled this but I'm not getting much joy.
Does anyone know of an easy way to read/write hex from/to a file in C?
Thank you.
Thank you, that works, I will examine your code to make sure I understand it.
Thanks again :)
Thanks for your reply.
If I do that don't I need to then keep track of every bit, for example -
Move the first bit of the second byte to the first byte, making it the lsb.
Move the first bit...
Hello
I really hope someone can help me with this. I have been working on it all weekend and I'm getting nowhere.
I need to left shift (with a rotate) an unsigned char array.
The array looks...