CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 12 of 12
  1. #1
    Join Date
    Jul 2009
    Posts
    40

    I need a crypter without control chars or nulls

    The topic says it all I need a crypt/decrypt function that works without control chars or null's.

    Thanks in advance!

    ( it dosen't need to be the best but something good that works would be great. )

  2. #2
    Join Date
    Apr 2009
    Posts
    598

    Re: I need a crypter without control chars or nulls

    Use a crypter which generates control chars and nulls, and then convert that string to ASCII85, see http://en.wikipedia.org/wiki/Ascii85 or to uuencode, see http://en.wikipedia.org/wiki/Uuencoding.

    Or maybe it is not a problem if you have control chars and nulls. In the past, I thought it was a problem because I saved a crypted password in a VARCHAR or in a VARCHAR2 field. Then, I realized, I could use a CHAR field instead in my database and the good thing is that a CHAR field can contain control chars and nulls.

  3. #3
    Join Date
    Jul 2009
    Posts
    40

    Re: I need a crypter without control chars or nulls

    Quote Originally Posted by olivthill2 View Post
    Use a crypter which generates control chars and nulls, and then convert that string to ASCII85, see http://en.wikipedia.org/wiki/Ascii85 or to uuencode, see http://en.wikipedia.org/wiki/Uuencoding.

    Or maybe it is not a problem if you have control chars and nulls. In the past, I thought it was a problem because I saved a crypted password in a VARCHAR or in a VARCHAR2 field. Then, I realized, I could use a CHAR field instead in my database and the good thing is that a CHAR field can contain control chars and nulls.
    it's not for a database that's why id rather not use ASCII85 and just have a crypter that uses only non-controls chars or null's

  4. #4
    Join Date
    Jan 2006
    Location
    Singapore
    Posts
    6,765

    Re: I need a crypter without control chars or nulls

    Use a cryptosystem that is regarded as secure by the experts, e.g., use AES. Satisfy your requirement for "non-controls chars or null's" by transforming the ciphertext into your desired format. Something like base 64 encoding could well suffice.
    C + C++ Compiler: MinGW port of GCC
    Build + Version Control System: SCons + Bazaar

    Look up a C/C++ Reference and learn How To Ask Questions The Smart Way
    Kindly rate my posts if you found them useful

  5. #5
    Join Date
    Jul 2009
    Posts
    40

    Re: I need a crypter without control chars or nulls

    Quote Originally Posted by laserlight View Post
    Use a cryptosystem that is regarded as secure by the experts, e.g., use AES. Satisfy your requirement for "non-controls chars or null's" by transforming the ciphertext into your desired format. Something like base 64 encoding could well suffice.
    I have AES how do you set those informations ?!

    I have a AES.lib and a aes.h os_1.h os_2.h openssconfg.h its already included in my project.

  6. #6
    Join Date
    Apr 1999
    Posts
    27,449

    Re: I need a crypter without control chars or nulls

    Quote Originally Posted by dsylebee View Post
    it's not for a database that's why id rather not use ASCII85 and just have a crypter that uses only non-controls chars or null's
    Do you know what ASCII85 is? An ASCII85 stream does not contain control characters or NULLs. If it did, it would defeat the purpose of it being ASCII85.

    ASCII85, Base64, and others are no more than variations on the same theme -- each algorithm creates a stream that has no null or control characters. How each algorithm works is different, but the final result is a stream that has plain ASCII characters that doesn't contain control characters or NULLs.

    Regards,

    Paul McKenzie

  7. #7
    Join Date
    Apr 1999
    Posts
    27,449

    Re: I need a crypter without control chars or nulls

    Quote Originally Posted by dsylebee View Post
    I have AES how do you set those informations ?!

    I have a AES.lib and a aes.h os_1.h os_2.h openssconfg.h its already included in my project.
    So you don't know how to use the library that is responsible for encrypting the text? Maybe that is what you should first know how to do, and that is how to start doing basic encryption.

    Does your library come with sample code?

    Regards,

    Paul McKenzie

  8. #8
    Join Date
    Jan 2004
    Location
    Düsseldorf, Germany
    Posts
    2,401

    Re: I need a crypter without control chars or nulls

    Quote Originally Posted by dsylebee View Post
    [...] id rather not use ASCII85 and just have a crypter that uses only non-controls chars or null's
    All advanced cryptology works on large (incredibly large) numbers. So the text you encrypt is interpreted as a bunch of bytes forming a large number and likewise the encrypted message is a large number as well. While each large number can be interpreted as a series of bytes, transforming it into a readable/displayable form is not part of the encrypter. Other algorithms exist for that, starting from hexdump over base64 to ASCI85.
    More computing sins are committed in the name of efficiency (without necessarily achieving it) than for any other single reason - including blind stupidity. --W.A.Wulf

    Premature optimization is the root of all evil --Donald E. Knuth


    Please read Information on posting before posting, especially the info on using [code] tags.

  9. #9
    Join Date
    Jun 2009
    Location
    France
    Posts
    2,513

    Re: I need a crypter without control chars or nulls

    Just to be clear, are you looking for an encrypter, or an encoder?

    Worst case scenario, you can encode with base64 the output of some random encryption scheme.

    Since you haven't been to clear about your needs, the answer is a bit vague...
    Is your question related to IO?
    Read this C++ FAQ article at parashift by Marshall Cline. In particular points 1-6.
    It will explain how to correctly deal with IO, how to validate input, and why you shouldn't count on "while(!in.eof())". And it always makes for excellent reading.

  10. #10
    Join Date
    Jul 2009
    Posts
    40

    Re: I need a crypter without control chars or nulls

    thanks all. it was a crypter. I managed with assci85

  11. #11
    Join Date
    Jun 2009
    Location
    France
    Posts
    2,513

    Re: I need a crypter without control chars or nulls

    Quote Originally Posted by dsylebee View Post
    thanks all. it was a crypter. I managed with assci85
    That's a terrible crypter. Anybody can decode it.
    Is your question related to IO?
    Read this C++ FAQ article at parashift by Marshall Cline. In particular points 1-6.
    It will explain how to correctly deal with IO, how to validate input, and why you shouldn't count on "while(!in.eof())". And it always makes for excellent reading.

  12. #12
    Join Date
    Apr 1999
    Posts
    27,449

    Re: I need a crypter without control chars or nulls

    Quote Originally Posted by dsylebee View Post
    thanks all. it was a crypter. I managed with assci85
    ASCII85 is an encoder, not a crypter. All ASCII85 does is to make sure that the stream doesn't contain control characters and NULLs.

    It does this by using an algorithm based on multiples of 85:

    See here:
    http://en.wikipedia.org/wiki/Ascii85

    So you didn't encrypt anything.

    Regards,

    Paul McKenzie

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured