CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3
  1. #1
    Join Date
    Dec 2003
    Posts
    4

    Question abt encryption algorithm

    hellooooo everyone here..

    i hv sum qns.. i m doin prj recently.. so hence doin encryption on patient text files.. i m new to encryption.. so i m using xor encryption. i noe it is basic .. but it is easy to be decrypted by hackers.. right? so, i use xor encryption wif random xor-value.
    is it ok?

    okie.. here math algorithm..::::

    srand(10); on top of the program -- // Init the random number generator with "10"...
    i dun get it.. pls enlighten mi..

    c=c ^ (rand()/12000 + 1);

    u noe y 12000+ 1 is used? y nt 12000 or any numbers? any more to tell mi regardin tt.. feel free to tell mi.. i m willing to learn more..

    that's all.. thanks. hope to hear frm u asap..

  2. #2
    Join Date
    Aug 2001
    Location
    Stockholm, Sweden
    Posts
    1,664
    You sure talk encrypted I'am having trouble decrypting your written language.

    If your question was: Is the standard C's pseudo random generator (PRG) algorithm ok for cryptography, the answer is NO !!!

    A few strange things with your scheme:
    1. What type is your 'c' variable?
    2. Why genereate a value between 0 and 12000?
    3. srand()/rand() is probably implemented differently on different compilers or versions of compilers. This is a problem if you for instance re-build your app with a different or newer compiler and then want to decrypt old files.
    4. Where is the encryption/decryption key???
    5. The entropy of rand() it very low (maybe as low as 15 bits), thus very unsecure PRG for cryptography

    If your program is running on Windows, use the MS Crypto API. It is not hard to use and there are several samples out on the net on how to use it.

    If the data you're protecting isn't that sensitive, you may "invent" and use your own encryption scheme... but think twice before doing it...

    Good luck.

  3. #3
    Join Date
    Dec 2003
    Posts
    4
    Originally posted by j0nas
    You sure talk encrypted I'am having trouble decrypting your written language.

    If your question was: Is the standard C's pseudo random generator (PRG) algorithm ok for cryptography, the answer is NO !!!

    A few strange things with your scheme:
    1. What type is your 'c' variable?
    2. Why genereate a value between 0 and 12000?
    3. srand()/rand() is probably implemented differently on different compilers or versions of compilers. This is a problem if you for instance re-build your app with a different or newer compiler and then want to decrypt old files.
    4. Where is the encryption/decryption key???
    5. The entropy of rand() it very low (maybe as low as 15 bits), thus very unsecure PRG for cryptography

    If your program is running on Windows, use the MS Crypto API. It is not hard to use and there are several samples out on the net on how to use it.

    If the data you're protecting isn't that sensitive, you may "invent" and use your own encryption scheme... but think twice before doing it...

    Good luck.

    hey jonas.. soli for my so so late reply.. hahaha.. well, coz of probs logging in my reply last yr.. so, i forget abt tt..
    hee.. i get wat u mean.. haHAHA. well, nvm abt tt.. coz, we used simple xor encryption with password needed in e end..

    anywae thx for ur help.. [if u can see this]

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