Thread: Encryption questions...

  1. #16
    Toaster Zach L.'s Avatar
    Join Date
    Aug 2001
    Posts
    2,686
    Well, the theories as a whole are not easy to understand, but some of the important theorems are. Look at the Handbook of Applied Cryptography; it has a fair bit of what you need, though in a rather terse format. Here is another link to an online book on algebra: http://www.math.uiuc.edu/~r-ash/Algebra.html
    The word rap as it applies to music is the result of a peculiar phonological rule which has stripped the word of its initial voiceless velar stop.

  2. #17
    Registered User
    Join Date
    Nov 2004
    Location
    Pennsylvania
    Posts
    434
    XORing or adding them together doesnt make much of a difference. If you take a piece of text, Encrypt it with a completely random string of letters and you get an imposssible to break cipher. No matter how much computer pwer youve got and how much time youve got you will never break the code. Adding them Exclusive-Or ing them whatever it doesnt matter. the reason i have got the %26) + 65 is to ensure all of the cipher characters are letters that can be saved in a file. Thanks!

  3. #18
    Nonconformist Narf's Avatar
    Join Date
    Aug 2005
    Posts
    174
    XORing or adding them together doesnt make much of a difference.
    True, but fuxxing about with the range using % is an easy way to get an encryption that you can't reverse unless you're damn good with practical modular arithmetic.
    the reason i have got the %26) + 65 is to ensure all of the cipher characters are letters that can be saved in a file
    Ya, I kinda figured that. But it's all just characters anyway, so it doesn't matter if they're letters or not. In fact, if they're just letters and not the full range of char then you've got yourself a weaker encryption.
    Just because I don't care doesn't mean I don't understand.

  4. #19
    Toaster Zach L.'s Avatar
    Join Date
    Aug 2001
    Posts
    2,686
    To add on to Narf's last point:

    a) You are not actually doing anything, as anything stored in a 'char' can be written to and read from a file; it may not look pretty, but then, that is not the point.
    b) You now have an algorithm that loses information (that is, more than one plaintext map to a given ciphertext, so there is no one-to-one correspondence between plaintext space and ciphertext space). This makes it more of a hash function.
    c) You assume 65 is the magical number associated with the character 'a'. Better just use 'a'.

    A one-time pad with a perfectly random key is the highest level of encryption. However, rand( ) is not cryptographically secure (in general) anyway (in fact, I have never heard of a cryptogrpahically secure implementation of <cstdlib>'s rand( ) ).

    Performing addition mod 2 on all of the bits is the same as a XOR.
    The word rap as it applies to music is the result of a peculiar phonological rule which has stripped the word of its initial voiceless velar stop.

  5. #20
    Registered User
    Join Date
    Aug 2005
    Location
    Austria
    Posts
    1,990
    Quote Originally Posted by Junior89
    Ok can anyone figure out why my code isnt working?
    One reason why you have problems is that the automatically generated key and the encrypted text are not 0-terminated.
    Kurt

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 16
    Last Post: 11-23-2007, 01:48 PM
  2. A very long list of questions... maybe to long...
    By Ravens'sWrath in forum C Programming
    Replies: 16
    Last Post: 05-16-2007, 05:36 AM
  3. Trivial questions - what to do?
    By Aerie in forum A Brief History of Cprogramming.com
    Replies: 23
    Last Post: 12-26-2004, 09:44 AM
  4. abt encryption algorithm
    By purIn in forum C Programming
    Replies: 9
    Last Post: 12-22-2003, 10:16 PM
  5. File Encryption & Read/Write in Binary Mode
    By kuphryn in forum C++ Programming
    Replies: 5
    Last Post: 11-30-2001, 06:45 PM