Results 1 to 4 of 4

Thread: suggestion for using strlen()

  1. #1
    Join Date
    Feb 2006
    Posts
    157
    Thanks
    12
    Thanked 1 Time in 1 Post
    Qt products
    Qt3 Qt4

    Default suggestion for using strlen()

    Hi guys,

    Can i use
    Qt Code:
    1. strlen()
    To copy to clipboard, switch view to plain text mode 
    to find the length of binary data...?

    My undetstanding is that strlen() will consider "\0" as the end of the data.
    But my confusion is like , if the data is encrypted , can we trust strlen()..???


    thanks in advance

  2. #2
    Join Date
    Jul 2008
    Location
    Netherlands
    Posts
    33
    Thanks
    2
    Thanked 3 Times in 3 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: suggestion for using strlen()

    You can't use strlen(), for the reason you already gave. When receiving encrypted data, you will have to have some prior knowledge on the amount of data you're (supposed to be) receiving. E.g.: uuEncoding specifies the line length in the first byte of each line, or yEncoding, that uses a terminator sequence that marks the end of the encoded data stream.

  3. #3
    Join Date
    Feb 2006
    Posts
    157
    Thanks
    12
    Thanked 1 Time in 1 Post
    Qt products
    Qt3 Qt4

    Default Re: suggestion for using strlen()

    I am using "RC4 encryption " algorithm .So my questions are ,

    1) Will RC4 algorithm added '\0' ( ie: null character ) at the end of encrypted data.
    2) Will RC4 algorithm assure that it will not add '\0' in between encrypted data ,except at the end of the encrypted data


    please help me

  4. #4
    Join Date
    Jul 2008
    Location
    Netherlands
    Posts
    33
    Thanks
    2
    Thanked 3 Times in 3 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: suggestion for using strlen()

    You can find the answer for example on Wikipedia. Short answers:
    1) No
    2) No

    Longer answers:
    1) Depends on the implementation of the algorithm, but generally, no.
    2) Depends on the input and implementation of the encrypting algorithm.

    DISCLAIMER: I infer these answers from a quick scan of the Wikipedia page, so correct me if I'm wrong...

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.