Just Crack Book2
Moderators: jelco, bert_the_turtle, Chris, Icepick, Rkiver, Punisher Bass
-
- level2
- Posts: 131
- Joined: Tue Sep 30, 2003 12:12 pm
- Contact:
-
- level5
- Posts: 11553
- Joined: Wed Jul 10, 2002 7:44 pm
- Location: Nashville, TN
- Contact:
-
- level0
- Posts: 2
- Joined: Thu Feb 26, 2004 6:17 pm
- Location: the underground empire
------------------------------------------------------------------------
as many had feared I will now post my source code for the programs: otp, count and strip.
(to Linux only)
otp.cc:
#include <fstream>
#include <stdlib.h>
int main( int argc, char *argv )
{ // there are no error handling because this program
// are only used in one way:
// otp <in_file> <key_file> <offset> <out_file>
int offset = atoi(argv[3]);
char ic = 0, kc = 0;
std::ifstream I(argv[1]);
std::ifstream K(argv[2]);
std::ofstream O(argv[4]);
for(int i = 0;i<offset;i++)
{
K.get(kc);
}
while(I.get(ic))
{
K.get(kc);
O << (char)(ic^kc);
}
I.close();
K.close();
O.close();
return 0;
}
EOF
count.cc:
#include <fstream>
#include <iostream>
int main( int argc, char *argv )
{ // there are no error handling because this program
// are only used in one way:
// count <in_file>
unsigned long i = 0;
char c;
std::ifstream I(argv[1]);
while(I.get(c))
{
i++;
}
std:cout << i << endl;
return 0;
}
EOF
strip.cc:
#include <fstream>
#include <iostream>
int main( int argc, char *argv )
{ // there are no error handling because this program
// are only used in one way:
// strip <in_file> <out_file>
char ic = 0;
std::ifstream I(argv[1]);
std::ofstream O(argv[2]);
for(int i=0; i < 16; i++)
{
I.get(ic);
}
while ( I.get(ic) )
{
O << ic;
}
I.close();
O.close();
return 0;
}
EOF
can you translate to mac ppc I am just a beginer programer
-
- level2
- Posts: 131
- Joined: Tue Sep 30, 2003 12:12 pm
- Contact:
oh.. and please state where you "lend" the Code.
Don't Think that I can't recognize my own scribblings,
eventhough it was back in late October last year.
well no hard feelings yet.... I think I do deserve some
or at least a tiny bit of credit for the hours I spent writing
those three files(or no?).
Don't Think that I can't recognize my own scribblings,
eventhough it was back in late October last year.
well no hard feelings yet.... I think I do deserve some
or at least a tiny bit of credit for the hours I spent writing
those three files(or no?).
-- as life grows older, I gain experience
-
- level2
- Posts: 131
- Joined: Tue Sep 30, 2003 12:12 pm
- Contact:
It should be possible to compile it under WinXP, perhaps with some
minor modifications, but I can't say for sure last time I use/developed
bits of the code (the file reading/writing) it compiled allright, however
it didn't produce the desired result
minor modifications, but I can't say for sure last time I use/developed
bits of the code (the file reading/writing) it compiled allright, however
it didn't produce the desired result
Last edited by Katana Steel on Sun Apr 10, 2005 8:58 pm, edited 1 time in total.
-- as life grows older, I gain experience
-
- level2
- Posts: 131
- Joined: Tue Sep 30, 2003 12:12 pm
- Contact:
I've seen that my code have been somewhat damaged in transport
from the old forum. So I've decided to post it with the error
corrected, and I plan to publish it at my Personal WebServer.
As many had feared I will now post my source code for the programs: otp, count and strip.
(to Linux only i got some weird results under Win32 using BCC32)
otp.cc:
count.cc:
strip.cc:
this is the code I used on gamebible 2.
and I use std:: on purpose not to pollute the std namespace
but you can go ahead an put in this line right after the includes:
And then remove all occurences of "std::" in the code.
Edit: Thanks Stew for pointing out those errors, I must have miss it.
The 'char *argv[]' are indeed needed nomatter what OS you run.
Edit: Removed the EOFz (looked goofy).
Edit: clean up some spelling, and added a line.
from the old forum. So I've decided to post it with the error
corrected, and I plan to publish it at my Personal WebServer.
As many had feared I will now post my source code for the programs: otp, count and strip.
(to Linux only i got some weird results under Win32 using BCC32)
otp.cc:
Code: Select all
// Copyrighted Alchemiestick IS
#include <fstream>
#include <stdlib.h>
int main( int argc, char *argv[] )
{ // there are no error handling because this program
// are only used in one way:
// otp <in_file> <key_file> <offset> <out_file>
int offset = atoi(argv[3]);
char ic = 0, kc = 0;
std::ifstream I(argv[1]);
std::ifstream K(argv[2]);
std::ofstream O(argv[4]);
for(int i = 0;i<offset;i++)
{
K.get(kc);
}
while(I.get(ic))
{
K.get(kc);
O << (char)(ic^kc);
}
I.close();
K.close();
O.close();
return 0;
}
count.cc:
Code: Select all
// Copyrighted Alchemiestick IS
#include <fstream>
#include <iostream>
int main( int argc, char *argv[] )
{ // there are no error handling because this program
// are only used in one way:
// count <in_file>
unsigned long i = 0;
char c;
std::ifstream I(argv[1]);
while(I.get(c))
{
i++;
}
std::cout << i << std::endl;
return 0;
}
strip.cc:
Code: Select all
// Copyrighted Alchemiestick IS
#include <fstream>
#include <iostream>
int main( int argc, char *argv[] )
{ // there are no error handling because this program
// are only used in one way:
// strip <in_file> <out_file>
char ic = 0;
std::ifstream I(argv[1]);
std::ofstream O(argv[2]);
for(int i=0; i < 16; i++)
{
I.get(ic);
}
while ( I.get(ic) )
{
O << ic;
}
I.close();
O.close();
return 0;
}
this is the code I used on gamebible 2.
and I use std:: on purpose not to pollute the std namespace
but you can go ahead an put in this line right after the includes:
Code: Select all
using namespace std;
And then remove all occurences of "std::" in the code.
Edit: Thanks Stew for pointing out those errors, I must have miss it.
The 'char *argv[]' are indeed needed nomatter what OS you run.
Edit: Removed the EOFz (looked goofy).
Edit: clean up some spelling, and added a line.
Last edited by Katana Steel on Sun Apr 10, 2005 9:01 pm, edited 2 times in total.
-- as life grows older, I gain experience
-
- level5
- Posts: 11553
- Joined: Wed Jul 10, 2002 7:44 pm
- Location: Nashville, TN
- Contact:
Who is online
Users browsing this forum: No registered users and 19 guests