Search:

Type: Posts; User: MrSteve

Search: Search took 0.01 seconds.

  1. Thanks everyone.

    Thanks everyone.
  2. So it's size will always be 1 (according to...

    So it's size will always be 1 (according to sizeof), but I can still use result to store 2 unsigned chars?
  3. Thanks everyone. slingerland3g: When I...

    Thanks everyone.

    slingerland3g:

    When I execute the following:


    unsigned char *result;

    result = malloc(2 * sizeof(unsigned char));
  4. Thank you for the replies. Do you mean this...

    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);
  5. Any way to dynamically change an array size in C?

    Hello

    Is there any way to dynamically change the size of an array?

    For example -


    unsigned char result[] = {0x01, 0x01}

    // do stuff with result
  6. OK, thanks, at least I now know what to do. ...

    OK, thanks, at least I now know what to do.

    Cheers.
  7. Ah, thank you, that makes sense. Do you know...

    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.
  8. Sizeof array increases by one byte after passing it to a function

    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};
  9. Thread: Array of bits?

    by MrSteve
    Replies
    5
    Views
    7,985

    Thanks Dave.

    Thanks Dave.
  10. Thread: Array of bits?

    by MrSteve
    Replies
    5
    Views
    7,985

    Thanks for the replies. Dave_Sinkula: would I...

    Thanks for the replies.

    Dave_Sinkula: would I be able to perform shifts (e.g. >>) using a bit set?
  11. Thread: Array of bits?

    by MrSteve
    Replies
    5
    Views
    7,985

    Array of bits?

    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...
  12. Thank you both for your replies. I'm new to C...

    Thank you both for your replies.

    I'm new to C and cryptorgraphy, so you have both been a great help.

    Thanks!
  13. RSA: Do I need to use a big int package for this?

    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...
  14. Replies
    4
    Views
    16,942

    Thank you for your reply. So if I have a text...

    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?
  15. Replies
    4
    Views
    16,942

    Read/Write hex from/to a file in C?

    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.
  16. Thank you, that works, I will examine your code...

    Thank you, that works, I will examine your code to make sure I understand it.

    Thanks again :)
  17. Thanks for your reply. If I do that don't I...

    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...
  18. Help! I am going crazy. Bit shifting a byte array

    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...
Results 1 to 18 of 18