XOR cipher help - fstream binary wrting

Re: XOR cipher help - fstream binary wrting

Post by thetan on Thu Nov 11, 2010 12:12 am
([msg=48796]see Re: XOR cipher help - fstream binary wrting[/msg])

fabianhjr wrote:thetan, apples elped me figure out strlen() was getting Null Byte poisoned.
Now I am porting everything to use vector<char>. I will post back when I archieve it. :)

Thanks Thetan!

Thats why you don't run strlen() on the file contents. Instead, you do like i did and create an additional argument for cipher() called clen, which is the length of the content to en/decrypt. The content length is either gathered from the stat() call on the file or a strlen() on an unencrypted string.

Other then that tgoe's point stands. The fact that you're going straight to C++ and hopping straight on the STL band wagon you're seriously cheating yourself and possibly fucking yourself into a self dug grave.

perhaps you're going about this all wrong. Get yourself a good book, otherwise you'll be dragging your dick around in the mud bashing your head against walls countless times.
"If art interprets our dreams, the computer executes them in the guise of programs!" - SICP

Image

“If at first, the idea is not absurd, then there is no hope for it” - Albert Einstein
User avatar
thetan
Contributor
Contributor
 
Posts: 657
Joined: Thu Dec 17, 2009 6:58 pm
Location: Various Bay Area Cities, California
Blog: View Blog (0)


Re: XOR cipher help - fstream binary wrting

Post by fabianhjr on Sat Nov 13, 2010 9:24 am
([msg=48856]see Re: XOR cipher help - fstream binary wrting[/msg])

I already downloaded some books. Tough, I will leave the cipher for later while I redo everything.
Other than that I am planning on getting a real physical book, tough, my options pretty much suck.
What is the book you would recommend from the ones listed here: http://ghandi.com.mx/index.cfm/id/Categoria/source/Libros/cid/1105
Or should I download an O'Reilly book?
Donate bitcoins to me! [1DhRP3hHgmSLQdRTZyT8VPTmzAj7Z2rsGA]
Dunno what bitcoins are? BitcoinMe
fabianhjr
Poster
Poster
 
Posts: 286
Joined: Tue Sep 21, 2010 7:48 pm
Blog: View Blog (0)


Re: XOR cipher help - fstream binary wrting

Post by thetan on Sat Nov 13, 2010 10:54 pm
([msg=48866]see Re: XOR cipher help - fstream binary wrting[/msg])

K&R - http://en.wikipedia.org/wiki/The_C_Prog ... uage_(book) - K&R is practically the canonical source for learning C

Bjourne Stroustrup, the creator of C++ has a couple books out on C++, you might want to check those out.

Then for programming in general, i have to recommend The Art of Computer Programming - Donald Knuth, TAOCP is fairly language nuetral and all serious programmers should read through them.
"If art interprets our dreams, the computer executes them in the guise of programs!" - SICP

Image

“If at first, the idea is not absurd, then there is no hope for it” - Albert Einstein
User avatar
thetan
Contributor
Contributor
 
Posts: 657
Joined: Thu Dec 17, 2009 6:58 pm
Location: Various Bay Area Cities, California
Blog: View Blog (0)


Re: XOR cipher help - fstream binary wrting

Post by tgoe on Sat Nov 13, 2010 11:11 pm
([msg=48867]see Re: XOR cipher help - fstream binary wrting[/msg])

Thats why you don't run strlen() on the file contents. Instead, you do like i did and create an additional argument for cipher() called clen, which is the length of the content to en/decrypt.

Just to be clear, that's the non-asshole version.

http://ghandi.com.mx/index.cfm/id/Producto/dept/Libros/pid/54537
User avatar
tgoe
Contributor
Contributor
 
Posts: 658
Joined: Sun Sep 28, 2008 2:33 pm
Location: q3dm7
Blog: View Blog (0)


Re: XOR cipher help - fstream binary wrting

Post by fabianhjr on Sun Nov 14, 2010 10:33 am
([msg=48876]see Re: XOR cipher help - fstream binary wrting[/msg])

Ok, thanks. I will go for it today. :D
Donate bitcoins to me! [1DhRP3hHgmSLQdRTZyT8VPTmzAj7Z2rsGA]
Dunno what bitcoins are? BitcoinMe
fabianhjr
Poster
Poster
 
Posts: 286
Joined: Tue Sep 21, 2010 7:48 pm
Blog: View Blog (0)


Previous

Return to C and C++

Who is online

Users browsing this forum: No registered users and 0 guests